PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
convertToString.h File Reference
#include <string>
#include <sstream>
#include "convertToString_impl.h"
+ Include dependency graph for convertToString.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T >
stringToValue (const std::string &str)
 Convert a string into value. More...
 
template<>
bool stringToValue< bool > (const std::string &str)
 Convert a string to value (specialisation for bool) More...
 
template<>
PPath stringToValue< PPath > (const std::string &str)
 Convert a string to value (specialisation for PPath) More...
 
template<>
PString stringToValue< PString > (const std::string &str)
 Convert a string to value (specialisation for PString) More...
 
template<>
std::string stringToValue< std::string > (const std::string &str)
 Convert a string to value (specialisation for string) More...
 
template<typename T >
std::string valueToString (const T &val)
 Convert a type into a string. More...
 
template<>
std::string valueToString< bool > (const bool &val)
 Convert a value to string (specialisation for bool) More...
 
template<>
std::string valueToString< PPath > (const PPath &val)
 Convert a value to string (specialisation for PPath) More...
 
template<>
std::string valueToString< PString > (const PString &val)
 Convert a value to string (specialisation for PString) More...
 
template<>
std::string valueToString< std::string > (const std::string &val)
 Convert a value to string (specialisation for string) More...
 

Function Documentation

◆ stringToValue()

template<typename T >
T stringToValue ( const std::string &  str)

Convert a string into value.

Parameters
str: string to be converted
Returns
converted value

Definition at line 30 of file convertToString_impl.h.

30  {
31  std::stringstream strStream;
32  strStream << str;
33  T val;
34  strStream >> val;
35  return val;
36 }

◆ stringToValue< bool >()

template<>
bool stringToValue< bool > ( const std::string &  str)

Convert a string to value (specialisation for bool)

Parameters
str: string
Returns
string value

Definition at line 79 of file convertToString.cpp.

79  {
80  return str == "true" || str == "1" || str == "yes";
81 }

Referenced by testConvertToString().

+ Here is the caller graph for this function:

◆ stringToValue< PPath >()

template<>
PPath stringToValue< PPath > ( const std::string &  str)

Convert a string to value (specialisation for PPath)

Parameters
str: string
Returns
string value

Definition at line 60 of file convertToString.cpp.

60  {
61  return PPath(str);
62 }
Path of a directory or a file.
Definition: PPath.h:17

Referenced by testConvertToString().

+ Here is the caller graph for this function:

◆ stringToValue< PString >()

template<>
PString stringToValue< PString > ( const std::string &  str)

Convert a string to value (specialisation for PString)

Parameters
str: string
Returns
string value

Definition at line 42 of file convertToString.cpp.

42  {
43  return str;
44 }

Referenced by testConvertToString().

+ Here is the caller graph for this function:

◆ stringToValue< std::string >()

template<>
std::string stringToValue< std::string > ( const std::string &  str)

Convert a string to value (specialisation for string)

Parameters
str: string
Returns
string value

Definition at line 24 of file convertToString.cpp.

24  {
25  return str;
26 }

◆ valueToString()

template<typename T >
std::string valueToString ( const T &  val)

Convert a type into a string.

Parameters
val: value to be converted
Returns
converted string

Definition at line 19 of file convertToString_impl.h.

19  {
20  std::stringstream str;
21  str << val;
22  return str.str();
23 }

Referenced by checkResultConvertToString(), PString::fromValue(), getSlideNumber(), openFileStream(), PString::operator+=(), PString::operator<<(), PString::operator=(), phoenix_check(), phoenix_save_value_to_dico(), PLog::resize(), testConvertToString(), and PString::toString().

+ Here is the caller graph for this function:

◆ valueToString< bool >()

template<>
std::string valueToString< bool > ( const bool &  val)

Convert a value to string (specialisation for bool)

Parameters
val: value
Returns
string

Definition at line 69 of file convertToString.cpp.

69  {
70  if(val){return "true";}
71  else{return "false";}
72 }

◆ valueToString< PPath >()

template<>
std::string valueToString< PPath > ( const PPath val)

Convert a value to string (specialisation for PPath)

Parameters
val: value
Returns
string

Definition at line 51 of file convertToString.cpp.

51  {
52  return val;
53 }

Referenced by testConvertToString().

+ Here is the caller graph for this function:

◆ valueToString< PString >()

template<>
std::string valueToString< PString > ( const PString val)

Convert a value to string (specialisation for PString)

Parameters
val: value
Returns
string

Definition at line 33 of file convertToString.cpp.

33  {
34  return val;
35 }

Referenced by testConvertToString().

+ Here is the caller graph for this function:

◆ valueToString< std::string >()

template<>
std::string valueToString< std::string > ( const std::string &  val)

Convert a value to string (specialisation for string)

Parameters
val: value
Returns
string

Definition at line 15 of file convertToString.cpp.

15  {
16  return val;
17 }