plastimatch
Loading...
Searching...
No Matches
string_util.h
Go to the documentation of this file.
1/* -----------------------------------------------------------------------
2 See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
3 ----------------------------------------------------------------------- */
4#ifndef _string_util_h_
5#define _string_util_h_
6
7#include "plmsys_config.h"
8#include <stdarg.h>
9#include <string>
10#include <vector>
11#include "plm_return_code.h"
12
13PLMSYS_API bool string_starts_with (const std::string& s1, const char* s2);
14PLMSYS_API bool string_starts_with (const char* s1, const char* s2);
15PLMSYS_API int plm_strcmp (const char* s1, const char* s2);
16PLMSYS_API std::string make_lowercase (const std::string& s);
17PLMSYS_API std::string make_uppercase (const std::string& s);
18PLMSYS_API std::string regularize_string (const std::string& s);
20PLMSYS_API Plm_return_code parse_int13 (int *arr, const char *string);
21PLMSYS_API Plm_return_code parse_int13 (int *arr, const std::string& string);
22PLMSYS_API Plm_return_code parse_float13 (float *arr, const char *string);
24 const std::string& string);
25PLMSYS_API Plm_return_code parse_dicom_float2 (float *arr, const char *string);
26PLMSYS_API Plm_return_code parse_dicom_float3 (float *arr, const char *string);
27PLMSYS_API Plm_return_code parse_dicom_float6 (float *arr, const char *string);
28PLMSYS_API std::vector<float> parse_dicom_float_vec (const char *string);
29PLMSYS_API std::vector<int> parse_int3_string (const char* s);
30PLMSYS_API std::vector<float> parse_float3_string (const char* s);
31PLMSYS_API std::vector<float> parse_float3_string (const std::string& s);
32PLMSYS_API std::vector<float> parse_float_string (const char* s);
33PLMSYS_API std::vector<float> parse_float_string (const std::string& s);
34PLMSYS_API const std::string string_trim (
35 const std::string& str,
36 const std::string& whitespace = " \t\r\n"
37);
38PLMSYS_API std::string slurp_file (const char* fn);
39PLMSYS_API std::string slurp_file (const std::string& fn);
40PLMSYS_API std::string string_format_va (const char *fmt, va_list ap);
41PLMSYS_API std::string string_format (const char* fmt, ...);
42PLMSYS_API size_t ci_find (const std::string& str1, const std::string& str2);
43
44PLMSYS_API bool string_value_true (const char* s);
45PLMSYS_API bool string_value_true (const std::string& s);
46PLMSYS_API bool string_value_false (const char* s);
47PLMSYS_API bool string_value_false (const std::string& s);
48
49template <typename T> PLMSYS_API std::string PLM_to_string(T value);
50template <typename T> PLMSYS_API std::string PLM_to_string(T *value, int n);
51
52PLMSYS_API std::vector<std::string>& string_split (const std::string &s, char delim, std::vector<std::string> &elems);
53PLMSYS_API std::vector<std::string> string_split (const std::string &s, char delim);
54PLMSYS_API bool split_key_val (const std::string& s,
55 std::string& key, std::string& val, char delim = '=');
56PLMSYS_API bool split_array_index (const std::string& s,
57 std::string& array, std::string& index);
58
59#endif
Plm_return_code
Definition plm_return_code.h:10
#define PLMSYS_API
Definition plmsys_config.h:19
std::vector< float > parse_float_string(const char *s)
Definition string_util.cxx:241
size_t ci_find(const std::string &str1, const std::string &str2)
Definition string_util.cxx:365
std::string make_uppercase(const std::string &s)
Definition string_util.cxx:46
bool split_array_index(const std::string &s, std::string &array, std::string &index)
Definition string_util.cxx:460
const std::string string_trim(const std::string &str, const std::string &whitespace=" \t\r\n")
Definition string_util.cxx:276
bool split_key_val(const std::string &s, std::string &key, std::string &val, char delim='=')
Definition string_util.cxx:442
bool string_value_false(const char *s)
Definition string_util.cxx:384
std::string string_format(const char *fmt,...)
Definition string_util.cxx:339
std::vector< float > parse_dicom_float_vec(const char *string)
Definition string_util.cxx:164
Plm_return_code parse_dicom_float6(float *arr, const char *string)
Definition string_util.cxx:150
Plm_return_code parse_int13(int *arr, const char *string)
Definition string_util.cxx:84
bool string_starts_with(const std::string &s1, const char *s2)
Definition string_util.cxx:20
void string_util_rtrim_whitespace(char *s)
Definition string_util.cxx:74
Plm_return_code parse_dicom_float3(float *arr, const char *string)
Definition string_util.cxx:138
std::vector< std::string > & string_split(const std::string &s, char delim, std::vector< std::string > &elems)
Definition string_util.cxx:418
std::string PLM_to_string(T value)
Definition string_util.cxx:396
Plm_return_code parse_float13(float *arr, const char *string)
Definition string_util.cxx:105
int plm_strcmp(const char *s1, const char *s2)
Definition string_util.cxx:32
std::string make_lowercase(const std::string &s)
Definition string_util.cxx:38
std::string string_format_va(const char *fmt, va_list ap)
Definition string_util.cxx:316
std::string regularize_string(const std::string &s)
Definition string_util.cxx:65
std::string slurp_file(const char *fn)
Definition string_util.cxx:295
Plm_return_code parse_dicom_float2(float *arr, const char *string)
Definition string_util.cxx:126
std::vector< int > parse_int3_string(const char *s)
Definition string_util.cxx:187
bool string_value_true(const char *s)
Definition string_util.cxx:373
std::vector< float > parse_float3_string(const char *s)
Definition string_util.cxx:211