| OLD | NEW |
| (Empty) |
| 1 // Copyright 2008-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 | |
| 16 #ifndef OMAHA_COMMON_EXTRA_ARGS_PARSER_H__ | |
| 17 #define OMAHA_COMMON_EXTRA_ARGS_PARSER_H__ | |
| 18 | |
| 19 #include <windows.h> | |
| 20 #include <atlstr.h> | |
| 21 #include "base/basictypes.h" | |
| 22 #include "omaha/common/command_line.h" | |
| 23 | |
| 24 namespace omaha { | |
| 25 | |
| 26 // This class handles tokenizing and parsing the ExtraArgs portion of the | |
| 27 // command line. | |
| 28 // The format of the extra arguments is as follows: | |
| 29 // appguid={}&.....appguid={}.... | |
| 30 // appguid has to be the first value of the extra arguments. | |
| 31 // Each appguid defines one product. | |
| 32 class ExtraArgsParser { | |
| 33 public: | |
| 34 ExtraArgsParser() : first_app_(false) {} | |
| 35 | |
| 36 // Parses the extra_args (the tag) and app_args (/appargs) strings, storing | |
| 37 // the results in args. | |
| 38 HRESULT Parse(const TCHAR* extra_args, | |
| 39 const TCHAR* app_args, | |
| 40 CommandLineExtraArgs* args); | |
| 41 | |
| 42 private: | |
| 43 HRESULT ParseExtraArgs(const TCHAR* extra_args, CommandLineExtraArgs* args); | |
| 44 | |
| 45 // Performs validation against extra_args and if it's valid, stores the | |
| 46 // extra_args value into args->extra_args. | |
| 47 HRESULT HandleToken(const CString& token, CommandLineExtraArgs* args); | |
| 48 | |
| 49 CommandLineAppArgs cur_extra_app_args_; | |
| 50 bool first_app_; | |
| 51 | |
| 52 DISALLOW_EVIL_CONSTRUCTORS(ExtraArgsParser); | |
| 53 }; | |
| 54 | |
| 55 } // namespace omaha | |
| 56 | |
| 57 #endif // OMAHA_COMMON_EXTRA_ARGS_PARSER_H__ | |
| OLD | NEW |