diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-09-15 13:22:34 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-09-15 13:22:34 (GMT) |
commit | 1ebc0709f1eceff56f81ccbb67d9acec15b79398 (patch) | |
tree | 5bfc9323e82b0091d431d81f530e2efbbdc115e7 /Source/kwsys/CommandLineArguments.cxx | |
parent | 785371af59ddc353a6af81d11bf0ec81c2488f53 (diff) | |
download | CMake-1ebc0709f1eceff56f81ccbb67d9acec15b79398.zip CMake-1ebc0709f1eceff56f81ccbb67d9acec15b79398.tar.gz CMake-1ebc0709f1eceff56f81ccbb67d9acec15b79398.tar.bz2 |
ENH: Move callback structure out of the public interface. Also block the warning on Visual Studio Debug
Diffstat (limited to 'Source/kwsys/CommandLineArguments.cxx')
-rw-r--r-- | Source/kwsys/CommandLineArguments.cxx | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx index 334c143..27bf6e6 100644 --- a/Source/kwsys/CommandLineArguments.cxx +++ b/Source/kwsys/CommandLineArguments.cxx @@ -25,6 +25,10 @@ #include <stdio.h> #include <stdlib.h> +#ifdef _MSC_VER +# pragma warning (disable: 4786) +#endif + namespace KWSYS_NAMESPACE { @@ -41,13 +45,24 @@ public: StdString(s, pos, n) {} }; +struct CommandLineArgumentsCallbackStructure +{ + const char* Argument; + int ArgumentType; + CommandLineArguments::CallbackType Callback; + void* CallData; + void* Variable; + int VariableType; + const char* Help; +}; + class CommandLineArgumentsVectorOfStrings : public kwsys_stl::vector<CommandLineArgumentsString> {}; class CommandLineArgumentsSetOfStrings : public kwsys_stl::set<CommandLineArgumentsString> {}; class CommandLineArgumentsMapOfStrucs : public kwsys_stl::map<CommandLineArgumentsString, - CommandLineArguments::CallbackStructure> {}; + CommandLineArgumentsCallbackStructure> {}; class CommandLineArgumentsInternal { @@ -143,7 +158,7 @@ int CommandLineArguments::Parse() it ++ ) { const CommandLineArguments::Internal::String& parg = it->first; - CommandLineArguments::CallbackStructure *cs = &it->second; + CommandLineArgumentsCallbackStructure *cs = &it->second; if (cs->ArgumentType == CommandLineArguments::NO_ARGUMENT || cs->ArgumentType == CommandLineArguments::SPACE_ARGUMENT) { @@ -175,7 +190,7 @@ int CommandLineArguments::Parse() // So, the longest one is probably the right one. Now see if it has any // additional value const char* value = 0; - CommandLineArguments::CallbackStructure *cs + CommandLineArgumentsCallbackStructure *cs = &this->Internals->Callbacks[matches[maxidx]]; const CommandLineArguments::Internal::String& sarg = matches[maxidx]; if ( cs->ArgumentType == NO_ARGUMENT ) @@ -328,7 +343,7 @@ void CommandLineArguments::GetRemainingArguments(int* argc, char*** argv) void CommandLineArguments::AddCallback(const char* argument, ArgumentTypeEnum type, CallbackType callback, void* call_data, const char* help) { - CommandLineArguments::CallbackStructure s; + CommandLineArgumentsCallbackStructure s; s.Argument = argument; s.ArgumentType = type; s.Callback = callback; @@ -345,7 +360,7 @@ void CommandLineArguments::AddCallback(const char* argument, ArgumentTypeEnum ty void CommandLineArguments::AddArgument(const char* argument, ArgumentTypeEnum type, VariableTypeEnum vtype, void* variable, const char* help) { - CommandLineArguments::CallbackStructure s; + CommandLineArgumentsCallbackStructure s; s.Argument = argument; s.ArgumentType = type; s.Callback = 0; @@ -434,7 +449,7 @@ const char* CommandLineArguments::GetHelp(const char* arg) // Since several arguments may point to the same argument, find the one this // one point to if this one is pointing to another argument. - CommandLineArguments::CallbackStructure *cs = &(it->second); + CommandLineArgumentsCallbackStructure *cs = &(it->second); while ( 1 ) { CommandLineArguments::Internal::CallbacksMap::iterator hit @@ -465,7 +480,7 @@ void CommandLineArguments::GenerateHelp() it != this->Internals->Callbacks.end(); it ++ ) { - CommandLineArguments::CallbackStructure *cs = &(it->second); + CommandLineArgumentsCallbackStructure *cs = &(it->second); mpit = mp.find(cs->Help); if ( mpit != mp.end() ) { @@ -481,7 +496,7 @@ void CommandLineArguments::GenerateHelp() it != this->Internals->Callbacks.end(); it ++ ) { - CommandLineArguments::CallbackStructure *cs = &(it->second); + CommandLineArgumentsCallbackStructure *cs = &(it->second); mpit = mp.find(cs->Help); if ( mpit != mp.end() ) { |