diff --git a/src/Examples/CMakeLists.txt b/src/Examples/CMakeLists.txt index 4e787076c0b4c95e00747c751cfcadf81f1ef855..502f90d8a3bce49bcae7167a8a06360868ba6ac2 100644 --- a/src/Examples/CMakeLists.txt +++ b/src/Examples/CMakeLists.txt @@ -33,15 +33,17 @@ target_link_libraries( LoggerExample tnl ) ADD_EXECUTABLE( MathExample MathExample.cpp ) target_link_libraries( MathExample tnl ) - ADD_EXECUTABLE( StringExample StringExample.cpp ) target_link_libraries( StringExample tnl ) +ADD_EXECUTABLE( StringExampleGetAllocatedSize StringExampleGetAllocatedSize.cpp ) +target_link_libraries( StringExampleGetAllocatedSize tnl ) + ADD_EXECUTABLE( StringExampleGetSize StringExampleGetSize.cpp ) target_link_libraries( StringExampleGetSize tnl ) -ADD_EXECUTABLE( StringExampleGetAllocatedSize StringExampleGetAllocatedSize.cpp ) -target_link_libraries( StringExampleGetAllocatedSize tnl ) +ADD_EXECUTABLE( StringExampleSetSize StringExampleSetSize.cpp ) +target_link_libraries( StringExampleSetSize tnl ) ADD_EXECUTABLE( TimerExample TimerExample.cpp ) target_link_libraries( TimerExample tnl ) \ No newline at end of file diff --git a/src/Examples/ConfigDescriptionExample.cpp b/src/Examples/ConfigDescriptionExample.cpp index 6d7d48d900226eacccf4851e43a35fa3cff7aa6d..59958f1d103458f247ec501b0bb08a1142eac8e6 100644 --- a/src/Examples/ConfigDescriptionExample.cpp +++ b/src/Examples/ConfigDescriptionExample.cpp @@ -1,12 +1,12 @@ #include <iostream> -#include <ConfigDescription.h> +#include <TNL/Config/ConfigDescription.h> using namespace TNL; using namespace std; int main() { - ConfigDescription confd; + Config::ConfigDescription confd; confd.template addEntry< String >("--new-entry","Specific description."); confd.template addEntryEnum< String >("option1"); confd.template addEntryEnum< String >("option2"); diff --git a/src/Examples/FileExample.cpp b/src/Examples/FileExample.cpp index f5f3912ddf6d9031e7c3e9c88541be121744fb44..18b73ca78c75083855f2329cfdd6dc77a86d6152 100644 --- a/src/Examples/FileExample.cpp +++ b/src/Examples/FileExample.cpp @@ -7,7 +7,7 @@ using namespace std; int main() { - File file; + /*File file; file.open( String("new-file.tnl"), IOMode::write ); String title("Header"); @@ -19,6 +19,6 @@ int main() file.read( title2, 4); file.close(); - cout << "title2:" << title2 <<endl; + cout << "title2:" << title2 <<endl;*/ } diff --git a/src/Examples/ListExample.cpp b/src/Examples/ListExample.cpp index 8737060d2154846e0a6e3e58d5e7ea38865a6109..7196dc7594689bca4395976f43b23c8b12d42eb5 100644 --- a/src/Examples/ListExample.cpp +++ b/src/Examples/ListExample.cpp @@ -1,13 +1,14 @@ #include <iostream> -#include <TNL/ConfigDescription.h> +#include <TNL/Config/ConfigDescription.h> +#include <TNL/Containers/List.h> +#include <TNL/Containers/Array.h> using namespace TNL; using namespace std; int main() { - template List< int > lst; - List lst; + Containers::List< int > lst; lst.isEmpty(); lst.Append(1); @@ -18,6 +19,6 @@ int main() lst.Insert(2,1); - Array array; - lst.template toArray< int >(array); + Containers::Array<int> array; + lst.toArray(array); } \ No newline at end of file diff --git a/src/Examples/LoggerExample.cpp b/src/Examples/LoggerExample.cpp index 9624502a23d1738137175fededaf854e5da1a5c9..cb4e3dc4a8548cb05eda84943e297e09b310e5e9 100644 --- a/src/Examples/LoggerExample.cpp +++ b/src/Examples/LoggerExample.cpp @@ -1,13 +1,13 @@ #include <iostream> #include <TNL/Logger.h> -#include <TNL/Config::ParameterContainer.h> +#include <TNL/Config/ParameterContainer.h> using namespace TNL; using namespace std; int main() { - Logger logger(50,stream); + Logger logger(50,cout); Config::ParameterContainer parameters; logger.writeSystemInformation(parameters); diff --git a/src/Examples/MathExample.cpp b/src/Examples/MathExample.cpp index 4e8db0931f7dc40075ec39de6c4222de1dda76f6..bb5e29b5e18b4660ecd2e96db8c617be09fafbb5 100644 --- a/src/Examples/MathExample.cpp +++ b/src/Examples/MathExample.cpp @@ -1,5 +1,5 @@ #include <iostream> -#include <Math.h> +#include <TNL/Math.h> using namespace TNL; using namespace std; @@ -7,5 +7,5 @@ using namespace std; int main() { isPow2(1024); - roundUpDevision(10,4); + roundUpDivision(10,4); } \ No newline at end of file diff --git a/src/Examples/StringExample.cpp b/src/Examples/StringExample.cpp index d6c45dee82f8df3e9fc0074719fce0961b9f8a55..f69fe9f1f70a1996892228600c9062855d6d0f40 100644 --- a/src/Examples/StringExample.cpp +++ b/src/Examples/StringExample.cpp @@ -1,5 +1,7 @@ #include <iostream> #include <TNL/String.h> +#include <TNL/Containers/List.h> +#include <TNL/File.h> using namespace TNL; using namespace std; @@ -28,15 +30,16 @@ int main( int argc, char* argv[] ) size = str3.getSize(); cout << "size of string:" << size << "bytes" << endl;*/ - String str - setter = str.setString( "Something new" ); + String str; + str.setString( "Something new" ); + String setter = str; cout << "setter:" << setter << endl; const char* getter = str4.getString(); cout << "getter:" << getter << endl; String word( "computer" ) ; - third_letter = word[2]; + char third_letter = word[2]; cout << "third_letter:" << third_letter << endl; // Operators for C Strings @@ -60,7 +63,7 @@ int main( int argc, char* argv[] ) // Operators for Strings String d1( "Cheese" ); - d = d1; + String d = d1; cout << "d:" << d << endl; String e( "Mac&" ); @@ -108,25 +111,27 @@ int main( int argc, char* argv[] ) // replace String phrase( "Hakuna matata" ); - new_phrase = phrase.replace( "a", "u", 2 ); + String new_phrase = phrase.replace( "a", "u", 2 ); cout << "new_phrase:" << new_phrase << endl; // strip String names(" Josh Martin John Marley Charles "); - better_names = names.strip(); + String better_names = names.strip(); cout << "better_names:" << better_names << endl; // split String dates("3/4/2005;8/7/2011;11/12/2019"); - list_dates = dates.split( list, ';' ); - cout << "list_dates:" << list_dates << endl; + Containers::List<String> list; + dates.split( list, ';' ); + cout << "list_dates:" << list << endl; // save - String("Header").save(my-file.tnl); // saves "Header" into file my-file.tnl + File myFile; + String("Header").save(myFile); // saves "Header" into myFile // load String strg; - strg.load(my-file.tnl); + strg.load(myFile); cout << "strg:" << strg << endl; // get line @@ -134,8 +139,8 @@ int main( int argc, char* argv[] ) text << "Hello!" << std::endl; text << "What's up?" << std::endl; - String str; - str.getLine( text ); - cout << "str:" << str << endl; + String string; + string.getLine( text ); + cout << "str:" << string << endl; } diff --git a/src/Examples/StringExampleGetAllocatedSize.cpp b/src/Examples/StringExampleGetAllocatedSize.cpp index 993ad3df4644e8d6330d7677a7064cc17f6ae729..ad616de67304d41769fbd4389a0d2d3e03e90546 100644 --- a/src/Examples/StringExampleGetAllocatedSize.cpp +++ b/src/Examples/StringExampleGetAllocatedSize.cpp @@ -1,10 +1,12 @@ #include <iostream> +#include <TNL/String.h> -using namespace TNL +using namespace TNL; +using namespace std; int main() { - String str("my world") + String str("my world"); int alloc_size = str.getAllocatedSize(); cout << "alloc_size:" << alloc_size << endl; } \ No newline at end of file diff --git a/src/Examples/StringExampleGetSize.cpp b/src/Examples/StringExampleGetSize.cpp index b2c30f63a7d30ce31aba6c7b0804dbd7a234509f..77fb499a478f45b9da7355355e01c747bdd1e639 100644 --- a/src/Examples/StringExampleGetSize.cpp +++ b/src/Examples/StringExampleGetSize.cpp @@ -1,10 +1,12 @@ #include <iostream> +#include <TNL/String.h> -using namespace TNL +using namespace TNL; +using namespace std; int main() { - String str("my world") + String str("my world"); int size = str.getSize(); cout << "size of string:" << size << "bytes" << endl; } diff --git a/src/Examples/StringExampleSetSize.cpp b/src/Examples/StringExampleSetSize.cpp index 2e53f88b687c8e23278d2c7cac1854d279f8f3ea..8451295a75a87f49e46c286cb5ef6ea94c06dcc8 100644 --- a/src/Examples/StringExampleSetSize.cpp +++ b/src/Examples/StringExampleSetSize.cpp @@ -1,10 +1,13 @@ #include <iostream> +#include <TNL/String.h> -using namespace TNL +using namespace TNL; +using namespace std; int main() { - int memory + String memory; memory.setSize( 256 ); - cout << "memory:" << memory << endl; + int memorysize = memory.getSize(); + cout << "memory:" << memorysize << endl; } diff --git a/src/Examples/TimerExample.cpp b/src/Examples/TimerExample.cpp index aa40367341170b319db7198c8db69873137d8aae..5d5a814540aa7265e023efb571627dffc3c47334 100644 --- a/src/Examples/TimerExample.cpp +++ b/src/Examples/TimerExample.cpp @@ -1,5 +1,6 @@ #include <iostream> #include <TNL/Timer.h> +#include <TNL/Logger.h> #include <unistd.h> using namespace TNL; @@ -16,7 +17,7 @@ int main() time.reset(); cout << "after reset:" << time.getRealTime() << endl; // writeLog example - Logger log1(50,stream); - writeLog( log1, 0 ); + Logger log1(50,cout); + time.writeLog( log1, 0 ); }