A helper class to manipulate string (token, convert, ...). More...
Static Public Member Functions | |
template<typename T > | |
static T | value_of (const std::string &in, bool *is_ok=0) |
return the value of the given string | |
template<typename T > | |
static std::vector< T > | value_of (const std::vector< std::string > &in, bool *is_ok=0) |
return the value of the given vector of string | |
template<typename T > | |
static std::string | to_string (const T &t) |
get the string corresponding to the given value | |
static std::string | zero_padding (const std::string &input, const int &zero_number=4) |
fill the appropriate number of zero to have the same size | |
template<typename T > | |
static std::string | to_string_padded (const T &x, const unsigned int &zero_number=4) |
helper to write padded string from a number easily | |
static std::string | to_lower (const std::string &input) |
return the lower case of a string | |
static std::string | to_upper (const std::string &input) |
return the upper case of a string | |
static std::vector< std::string > | delete_empty (const std::vector< std::string > &in) |
delete the empty space of a vector of string | |
static std::pair< std::pair < int, int >, std::pair < std::string, std::string > > | extract_number_part (const std::string &filename) |
extract the last number part of a string and give the number of zeros | |
static std::vector< std::string > | load_filename_sequence (const std::string filename, const unsigned int &iteration=1) |
load file sequence |
A helper class to manipulate string (token, convert, ...).
A class to convert a string into value or value into string
std::vector< std::string > cpe::string_converter::delete_empty | ( | const std::vector< std::string > & | in | ) | [static] |
delete the empty space of a vector of string
Referenced by cpe::mesh_io_off::load_mesh_io_off(), and cpe::texture::load_ppm_picture().
std::pair< std::pair< int, int >, std::pair< std::string, std::string > > cpe::string_converter::extract_number_part | ( | const std::string & | filename | ) | [static] |
extract the last number part of a string and give the number of zeros
int,: | number found (-1 if failed) | |
int,: | number of zeros (-1 if failed) | |
string,: | first part of the word | |
string,: | last part of the word |
ex. my_file_001.dat -> number=1, zeros=2, part_1="my_file_" part_2=".dat"
Referenced by load_filename_sequence().
std::vector< std::string > cpe::string_converter::load_filename_sequence | ( | const std::string | filename, | |
const unsigned int & | iteration = 1 | |||
) | [static] |
load file sequence
Try to load every filename following the numbers on disk
References extract_number_part(), to_string(), and zero_padding().
std::string cpe::string_converter::to_lower | ( | const std::string & | input | ) | [static] |
return the lower case of a string
static std::string cpe::string_converter::to_string | ( | const T & | t | ) | [inline, static] |
get the string corresponding to the given value
example: std::string val=mesh_convstring_converter::to_string(4.0*78.5);
Referenced by cpe::v4::assert_size(), cpe::v3::assert_size(), cpe::surface_param::assert_size(), cpe::matrix4::assert_size(), cpe::matrix3::assert_size(), cpe::grid::assert_size(), cpe::quad_index::assert_size(), cpe::mesh::get_texture_tx(), cpe::mesh::get_texture_ty(), cpe::mesh::get_vertex(), load_filename_sequence(), cpe::mesh::set_texture(), and to_string_padded().
static std::string cpe::string_converter::to_string_padded | ( | const T & | x, | |
const unsigned int & | zero_number = 4 | |||
) | [inline, static] |
helper to write padded string from a number easily
References to_string(), and zero_padding().
std::string cpe::string_converter::to_upper | ( | const std::string & | input | ) | [static] |
return the upper case of a string
static std::vector<T> cpe::string_converter::value_of | ( | const std::vector< std::string > & | in, | |
bool * | is_ok = 0 | |||
) | [inline, static] |
return the value of the given vector of string
static T cpe::string_converter::value_of | ( | const std::string & | in, | |
bool * | is_ok = 0 | |||
) | [inline, static] |
return the value of the given string
example: double val=mesh_convstring_converter::value_of<double> ("4.54");
std::string cpe::string_converter::zero_padding | ( | const std::string & | input, | |
const int & | zero_number = 4 | |||
) | [static] |
fill the appropriate number of zero to have the same size
exemple zero_padding("62",5)="00062"
exemple zero_padding("c;7",4)="0x;7"
Referenced by load_filename_sequence(), and to_string_padded().