169570cc8Sopenharmony_ci/*
269570cc8Sopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd.
369570cc8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
469570cc8Sopenharmony_ci * you may not use this file except in compliance with the License.
569570cc8Sopenharmony_ci * You may obtain a copy of the License at
669570cc8Sopenharmony_ci *
769570cc8Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
869570cc8Sopenharmony_ci *
969570cc8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1069570cc8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1169570cc8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1269570cc8Sopenharmony_ci * See the License for the specific language governing permissions and
1369570cc8Sopenharmony_ci * limitations under the License.
1469570cc8Sopenharmony_ci */
1569570cc8Sopenharmony_ci
1669570cc8Sopenharmony_ci#ifndef COMMAND_LEXER_H
1769570cc8Sopenharmony_ci#define COMMAND_LEXER_H
1869570cc8Sopenharmony_ci
1969570cc8Sopenharmony_ci#include <string>
2069570cc8Sopenharmony_ci#include <vector>
2169570cc8Sopenharmony_ci
2269570cc8Sopenharmony_cinamespace OHOS {
2369570cc8Sopenharmony_cinamespace AppSpawn {
2469570cc8Sopenharmony_ci
2569570cc8Sopenharmony_ciclass CommandLexer {
2669570cc8Sopenharmony_cipublic:
2769570cc8Sopenharmony_ci    explicit CommandLexer(const std::string &str) : str_(str) {}
2869570cc8Sopenharmony_ci    // Disable copy and move semantics to avoid extension of the lifecyle of the
2969570cc8Sopenharmony_ci    // resource not owned by this class.
3069570cc8Sopenharmony_ci    CommandLexer(const CommandLexer &other) = delete;
3169570cc8Sopenharmony_ci    CommandLexer(CommandLexer &&other) = delete;
3269570cc8Sopenharmony_ci    CommandLexer &operator=(const CommandLexer &other) = delete;
3369570cc8Sopenharmony_ci    CommandLexer &operator=(CommandLexer &&other) = delete;
3469570cc8Sopenharmony_ci    // Return true, and args will be populated with all argument. Otherwise,
3569570cc8Sopenharmony_ci    // false is returned, and args will be cleared.
3669570cc8Sopenharmony_ci    bool GetAllArguments(std::vector<std::string> &args);
3769570cc8Sopenharmony_ci
3869570cc8Sopenharmony_ciprivate:
3969570cc8Sopenharmony_ci    const std::string &str_;
4069570cc8Sopenharmony_ci};
4169570cc8Sopenharmony_ci
4269570cc8Sopenharmony_ci} // namespace AppSpawn
4369570cc8Sopenharmony_ci} // namespace OHOS
4469570cc8Sopenharmony_ci
4569570cc8Sopenharmony_ci#endif // COMMAND_LEXER_H
46