PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
main.cpp File Reference
#include <iostream>
#include "phoenix_assert.h"
#include "PStream.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void testPStream ()
 Test the PStream. More...
 
void testPStreamMatrix ()
 Test the PStream. More...
 
void testPStreamTable ()
 Test the PStream. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 68 of file main.cpp.

68  {
69  testPStream();
72  return 0;
73 }
void testPStream()
Test the PStream.
Definition: main.cpp:13
void testPStreamMatrix()
Test the PStream.
Definition: main.cpp:49
void testPStreamTable()
Test the PStream.
Definition: main.cpp:29

References testPStream(), testPStreamMatrix(), and testPStreamTable().

+ Here is the call graph for this function:

◆ testPStream()

void testPStream ( )

Test the PStream.

Definition at line 13 of file main.cpp.

13  {
14  PStream strOut;
15  phoenix_assert(strOut.open(PPath("testInt.bin"), "w"));
16  strOut << 42;
17  strOut.close();
18 
19  PStream strIn;
20  phoenix_assert(strIn.open(PPath("testInt.bin"), "r"));
21  int val(0);
22  strIn >> val;
23 
24  std::cout << "testPStream : val = " << val << std::endl;
25  phoenix_assert(val == 42);
26 }
Path of a directory or a file.
Definition: PPath.h:17
Deal with binary stream.
Definition: PStream.h:14
bool open(const PPath &fileName, const PString &mode="r")
Open the current stream.
Definition: PStream.cpp:25
void close()
Close the stream.
Definition: PStream.cpp:32
#define phoenix_assert(isOk)

References PStream::close(), PStream::open(), and phoenix_assert.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testPStreamMatrix()

void testPStreamMatrix ( )

Test the PStream.

Definition at line 49 of file main.cpp.

49  {
50  int tabInt [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
51  int tabIntRead [] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
52 
53  PStream strOut;
54  phoenix_assert(strOut.open(PPath("testMatInt.bin"), "w"));
55  strOut.write(tabInt, 2lu, 5lu, 0lu);
56  strOut.close();
57 
58  PStream strIn;
59  phoenix_assert(strIn.open(PPath("testMatInt.bin"), "r"));
60  strIn.read(tabIntRead, 2lu, 5lu, 0lu);
61 
62  std::cout << "testPStreamMatrix : tabIntRead[9] = " << tabIntRead[9] << std::endl;
63  for(size_t i(0); i < 10lu; ++i){
64  phoenix_assert(tabInt[i] == tabIntRead[i]);
65  }
66 }
bool write(const T &value)
Write a value into the stream.
Definition: PStream_impl.h:37
bool read(T &value)
Read a value from the stream.
Definition: PStream_impl.h:73

References PStream::close(), PStream::open(), phoenix_assert, PStream::read(), and PStream::write().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testPStreamTable()

void testPStreamTable ( )

Test the PStream.

Definition at line 29 of file main.cpp.

29  {
30  int tabInt [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
31  int tabIntRead [] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
32 
33  PStream strOut;
34  phoenix_assert(strOut.open(PPath("testTabInt.bin"), "w"));
35  strOut.write(tabInt, 10lu);
36  strOut.close();
37 
38  PStream strIn;
39  phoenix_assert(strIn.open(PPath("testTabInt.bin"), "r"));
40  strIn.read(tabIntRead, 10lu);
41 
42  std::cout << "testPStreamTable : tabIntRead[9] = " << tabIntRead[9] << std::endl;
43  for(size_t i(0); i < 10lu; ++i){
44  phoenix_assert(tabInt[i] == tabIntRead[i]);
45  }
46 }

References PStream::close(), PStream::open(), phoenix_assert, PStream::read(), and PStream::write().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: