From 1ebc0709f1eceff56f81ccbb67d9acec15b79398 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Wed, 15 Sep 2004 09:22:34 -0400 Subject: [PATCH] ENH: Move callback structure out of the public interface. Also block the warning on Visual Studio Debug --- Source/kwsys/CommandLineArguments.cxx | 31 ++++++++++++++++++------ Source/kwsys/CommandLineArguments.hxx.in | 11 --------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx index 334c14399..27bf6e60e 100644 --- a/Source/kwsys/CommandLineArguments.cxx +++ b/Source/kwsys/CommandLineArguments.cxx @@ -25,6 +25,10 @@ #include #include +#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 {}; class CommandLineArgumentsSetOfStrings : public kwsys_stl::set {}; class CommandLineArgumentsMapOfStrucs : public kwsys_stl::map {}; + 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() ) { diff --git a/Source/kwsys/CommandLineArguments.hxx.in b/Source/kwsys/CommandLineArguments.hxx.in index 667151680..a88ef2629 100644 --- a/Source/kwsys/CommandLineArguments.hxx.in +++ b/Source/kwsys/CommandLineArguments.hxx.in @@ -71,17 +71,6 @@ public: void* call_data); typedef int(*ErrorCallbackType)(const char* argument, void* client_data); - struct CallbackStructure - { - const char* Argument; - int ArgumentType; - CallbackType Callback; - void* CallData; - void* Variable; - int VariableType; - const char* Help; - }; - /** * Initialize internal data structures. This should be called before parsing. */