| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This is the file that should be included by any file which declares | 5 // This is the file that should be included by any file which declares |
| 6 // or defines a command line flag or wants to parse command line flags | 6 // or defines a command line flag or wants to parse command line flags |
| 7 // or print a program usage message (which will include information about | 7 // or print a program usage message (which will include information about |
| 8 // flags). Executive summary, in the form of an example foo.cc file: | 8 // flags). Executive summary, in the form of an example foo.cc file: |
| 9 // | 9 // |
| 10 // #include "foo.h" // foo.h has a line "DECLARE_int32(start);" | 10 // #include "foo.h" // foo.h has a line "DECLARE_int32(start);" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #define BASE_COMMANDLINEFLAGS_H_ | 23 #define BASE_COMMANDLINEFLAGS_H_ |
| 24 | 24 |
| 25 #include <assert.h> | 25 #include <assert.h> |
| 26 #include <string> | 26 #include <string> |
| 27 #include <vector> | 27 #include <vector> |
| 28 #include "base/basictypes.h" | 28 #include "base/basictypes.h" |
| 29 #include "base/port.h" | 29 #include "base/port.h" |
| 30 #include "base/stl_decl_msvc.h" | 30 #include "base/stl_decl_msvc.h" |
| 31 #include "base/global_strip_options.h" | 31 #include "base/global_strip_options.h" |
| 32 | 32 |
| 33 using std::string; |
| 34 using std::vector; |
| 35 |
| 33 // -------------------------------------------------------------------- | 36 // -------------------------------------------------------------------- |
| 34 // To actually define a flag in a file, use DEFINE_bool, | 37 // To actually define a flag in a file, use DEFINE_bool, |
| 35 // DEFINE_string, etc. at the bottom of this file. You may also find | 38 // DEFINE_string, etc. at the bottom of this file. You may also find |
| 36 // it useful to register a validator with the flag. This ensures that | 39 // it useful to register a validator with the flag. This ensures that |
| 37 // when the flag is parsed from the commandline, or is later set via | 40 // when the flag is parsed from the commandline, or is later set via |
| 38 // SetCommandLineOption, we call the validation function. | 41 // SetCommandLineOption, we call the validation function. |
| 39 // | 42 // |
| 40 // The validation function should return true if the flag value is valid, and | 43 // The validation function should return true if the flag value is valid, and |
| 41 // false otherwise. If the function returns false for the new setting of the | 44 // false otherwise. If the function returns false for the new setting of the |
| 42 // flag, the flag will retain its current value. If it returns false for the | 45 // flag, the flag will retain its current value. If it returns false for the |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 static FlagRegisterer o_##name( \ | 437 static FlagRegisterer o_##name( \ |
| 435 #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ | 438 #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ |
| 436 s_##name[0].s, new (s_##name[1].s) string(*FLAGS_no##name)); \ | 439 s_##name[0].s, new (s_##name[1].s) string(*FLAGS_no##name)); \ |
| 437 string& FLAGS_##name = *(reinterpret_cast<string*>(s_##name[0].s)); \ | 440 string& FLAGS_##name = *(reinterpret_cast<string*>(s_##name[0].s)); \ |
| 438 } \ | 441 } \ |
| 439 using fLS::FLAGS_##name | 442 using fLS::FLAGS_##name |
| 440 | 443 |
| 441 #endif // SWIG | 444 #endif // SWIG |
| 442 | 445 |
| 443 #endif // BASE_COMMANDLINEFLAGS_H_ | 446 #endif // BASE_COMMANDLINEFLAGS_H_ |
| OLD | NEW |