From d6edf05a51ecba86ca0ea2f3fece730e39c1f42e Mon Sep 17 00:00:00 2001 From: Nina Dzugasova <dzugasova.nina@gmail.com> Date: Tue, 13 Nov 2018 09:49:24 +0100 Subject: [PATCH] Added String examples. --- src/Examples/StringExampleGetAllocatedSize.cpp | 10 ++++++++++ src/Examples/StringExampleGetSize.cpp | 11 +++++++++++ src/Examples/StringExampleSetSize.cpp | 10 ++++++++++ 3 files changed, 31 insertions(+) create mode 100644 src/Examples/StringExampleGetAllocatedSize.cpp create mode 100644 src/Examples/StringExampleGetSize.cpp create mode 100644 src/Examples/StringExampleSetSize.cpp diff --git a/src/Examples/StringExampleGetAllocatedSize.cpp b/src/Examples/StringExampleGetAllocatedSize.cpp new file mode 100644 index 0000000000..993ad3df46 --- /dev/null +++ b/src/Examples/StringExampleGetAllocatedSize.cpp @@ -0,0 +1,10 @@ +#include <iostream> + +using namespace TNL + +int main() +{ + 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 new file mode 100644 index 0000000000..b2c30f63a7 --- /dev/null +++ b/src/Examples/StringExampleGetSize.cpp @@ -0,0 +1,11 @@ +#include <iostream> + +using namespace TNL + +int main() +{ + 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 new file mode 100644 index 0000000000..2e53f88b68 --- /dev/null +++ b/src/Examples/StringExampleSetSize.cpp @@ -0,0 +1,10 @@ +#include <iostream> + +using namespace TNL + +int main() +{ + int memory + memory.setSize( 256 ); + cout << "memory:" << memory << endl; +} -- GitLab