Skip to content

Commit aea7ab7

Browse files
Fixed default arguments
1 parent 4f1f2fa commit aea7ab7

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

SQLiteClassBuilder.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main(int argc, char* argv[])
5151
("d,database", "File name of the SQLite database. Required argument!! Example: SQLiteClassBuilder -d\"C:\\Data\\myDatabase.db\"", cxxopts::value<std::string>()->default_value(""))
5252
("w,where", "Optional: And-Where-Clause. Can be used to specify a set of tables/views to process.\nExample1:\nSQLiteClassBuilder -d\"my.db\" -w\"AND tbl_name like 'Personnel%'\"\nExample2:\nSQLiteClassBuilder -d\"my.db\" -w\"AND tbl_name NOT like 'zzTest%'\"", cxxopts::value<std::string>()->default_value(""))
5353
("v,verbosity", "Verbosity level. Default: 3. 0=No-output; 1=Error-Output-Only; 2=Err+Warn; 3=Err+Wrn+Info; 4=Err+Wrn+Info+Debug; 5=Err+Wrn+Info+Debug+Details", cxxopts::value<int>()->default_value("3"))
54-
("p,pause", "Pause before program exit. Note: If verbosity level 0, program will exit without pause unless error occurs.", cxxopts::value<bool>()->default_value("true"))
54+
("p,nopause", "Do NOT pause before program exit. Note: If verbosity level 0, program will exit without pause unless error occurs.", cxxopts::value<bool>()->default_value("false"))
5555
("h,help", "Print usage")
5656
// ("d,debug", "Enable debugging", cxxopts::value<bool>()->default_value("false")) // ToDo: Delete this argument if it doesn't get used.
5757
// ("c,clipboard", "Populate bla bla from clipboard", cxxopts::value<bool>()->default_value("false"), "bool")
@@ -72,17 +72,17 @@ int main(int argc, char* argv[])
7272
("x,xinterf", "Exclude SQLite3pp::Table interface. Default: A set of methods (getTableName, getColumnNames, getSelecColumnNames, and getStreamData) are created for each class in order to interface with SQLite3pp::Table.", cxxopts::value<bool>()->default_value("false"))
7373
("b,basic_t", "Only use C++ basic types (int, double, std::string, and std::wstring). Default: Use SQLite2 and SQLite3 sub types (Text, Integer, Blob, Clob, Date, Datetime, Boolean, Bigint, Varchar, Nchr, etc...).", cxxopts::value<bool>()->default_value("false"))
7474
("m,xvalid", "Exclude test validation examples in main header. Default: Test validation examples are created in main header.", cxxopts::value<bool>()->default_value("false"))
75-
("n,cvalid", "Comment out example in main header. Default: Validation examples in main header are commented out.", cxxopts::value<bool>()->default_value("true"))
75+
("n,cvalid", "Do NOT comment out example in main header. Default: Validation examples in main header are commented out.", cxxopts::value<bool>()->default_value("false"))
7676
;
7777
options.add_options("Header")
7878
//HeaderOpt
7979
("f,folder", "Distination folder. Path where headers are created.", cxxopts::value<std::string>()->default_value("SQL"))
8080
("a,prefix", "Specify a desired prefix for created headers. Default: \"sql_\".", cxxopts::value<std::string>()->default_value("sql_"))
8181
("z,postfix", "Optionally specify a desired postfix for created headers. Default: empty.", cxxopts::value<std::string>()->default_value(""))
8282
("y,fileext", "File type to create (h, hpp, class, hxx). Note: If empty, default type is used. Default: \"h\".", cxxopts::value<std::string>()->default_value("h"))
83-
("i,include", "#include to add to all headers. Note: If empty, no additional include is added. Default: \"sqlite3pp_ez.h\".", cxxopts::value<std::string>()->default_value("sqlite3pp_ez.h"))
83+
("i,include", "#include to add to all headers. Note: If empty, no additional include is added. Default: \"..\\sqlite3pp_ez.h\".", cxxopts::value<std::string>()->default_value("..\\sqlite3pp_ez.h"))
8484
("r,rmdir", "Remove destination directory before creating headers", cxxopts::value<bool>()->default_value("false"))
85-
("q,dhead", "Delete all sql_*.h files before creating headers.", cxxopts::value<bool>()->default_value("true"))
85+
("q,dhead", "Do NOT delete sql_*.h files before creating headers.", cxxopts::value<bool>()->default_value("false"))
8686
;
8787
auto arg_result = options.parse(argc, argv);
8888
const int VerbosityLevel = arg_result["verbosity"].as<int>();
@@ -126,14 +126,14 @@ int main(int argc, char* argv[])
126126
V_COUT(DETAIL, "Using destination path '" << TargetPath << "'.");
127127
if (arg_result["rmdir"].as<bool>())
128128
{
129-
if (sqlite3pp::SQLiteClassBuilder::dir_exists(TargetPath.c_str()))
129+
if (sqlite3pp::dir_exists(TargetPath.c_str()))
130130
{
131131
V_COUT(INFO, "Removing directory '" << TargetPath << "' before creating headers.");
132132
_rmdir(TargetPath.c_str());
133133
}
134134
}
135135

136-
if (!sqlite3pp::SQLiteClassBuilder::dir_exists(TargetPath.c_str()))
136+
if (!sqlite3pp::dir_exists(TargetPath.c_str()))
137137
{
138138
V_COUT(INFO, "Creating target path '" << TargetPath << "'.");
139139
_mkdir(TargetPath.c_str());
@@ -143,7 +143,7 @@ int main(int argc, char* argv[])
143143
std::string FileExt = arg_result["fileext"].as<std::string>().size() ? arg_result["fileext"].as<std::string>() : "h";
144144
V_COUT(DETAIL, "Files created will use file extension '" << FileExt << "'.");
145145

146-
if (arg_result["dhead"].as<bool>())
146+
if (!arg_result["dhead"].as<bool>())
147147
{
148148
V_COUT(INFO, "Deleting exsiting headers.");
149149
std::string Command = "del /F /Q " + TargetPath + "\\" + arg_result["prefix"].as<std::string>() + "*" + arg_result["postfix"].as<std::string>() + "." + FileExt;
@@ -184,10 +184,10 @@ int main(int argc, char* argv[])
184184
my_MiscOptions.exclude_table_interface = arg_result["xinterf"].as<bool>();
185185
my_MiscOptions.use_basic_types_only = arg_result["basic_t"].as<bool>();
186186
my_MiscOptions.exclude_main_hdr_example = arg_result["xvalid"].as<bool>();
187-
my_MiscOptions.exclude_comment_out_exampl = !arg_result["cvalid"].as<bool>();
187+
my_MiscOptions.exclude_comment_out_exampl = arg_result["cvalid"].as<bool>();
188188

189189
//HeaderOpt
190-
sqlite3pp::HeaderOpt my_HeaderOpt = sqlite3pp::SqlBld::HeaderDefaultOpt;
190+
sqlite3pp::HeaderOpt my_HeaderOpt = sqlite3pp::SqlBld::HeadersCreatedSqlDir;
191191
my_HeaderOpt.dest_folder = TargetPath + "\\";
192192
my_HeaderOpt.file_type = FileExt;
193193
my_HeaderOpt.header_postfix = arg_result["postfix"].as<std::string>();
@@ -204,7 +204,10 @@ int main(int argc, char* argv[])
204204
);
205205

206206
V_COUT(INFO, "\n\n***************************************\nProcess Complete.\nCreated " << createsqlitetableclass.GetHeadersCreated().size() << " classes and headers.\n***************************************\n");
207-
if (arg_result["pause"].as<bool>() && VerbosityLevel)
207+
208+
bool PauseBeforeExit = !arg_result["nopause"].as<bool>(); // Not Not
209+
210+
if (PauseBeforeExit && VerbosityLevel)
208211
system("pause");
209212

210213
return 0;

SQLiteClassBuilder.vcxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,23 @@
7676
<PropertyGroup Label="UserMacros" />
7777
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
7878
<LinkIncremental>true</LinkIncremental>
79-
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
80-
<IntDir>$(ProjectDir)bin\Intermediates\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
79+
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
80+
<IntDir>$(SolutionDir)bin\Intermediates\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
8181
</PropertyGroup>
8282
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
8383
<LinkIncremental>true</LinkIncremental>
84-
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
85-
<IntDir>$(ProjectDir)bin\Intermediates\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
84+
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
85+
<IntDir>$(SolutionDir)bin\Intermediates\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
8686
</PropertyGroup>
8787
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
8888
<LinkIncremental>false</LinkIncremental>
89-
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
90-
<IntDir>$(ProjectDir)bin\Intermediates\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
89+
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
90+
<IntDir>$(SolutionDir)bin\Intermediates\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
9191
</PropertyGroup>
9292
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
9393
<LinkIncremental>false</LinkIncremental>
94-
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
95-
<IntDir>$(ProjectDir)bin\Intermediates\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
94+
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
95+
<IntDir>$(SolutionDir)bin\Intermediates\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
9696
</PropertyGroup>
9797
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
9898
<ClCompile>

0 commit comments

Comments
 (0)