File: StringConvert.h

package info (click to toggle)
mriconvert 1%3A2.1.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,488 kB
  • sloc: cpp: 17,029; makefile: 11
file content (43 lines) | stat: -rw-r----- 1,081 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/// StringConvert.h
/**
*/

#ifndef STRINGCONVERT_H_
#define STRINGCONVERT_H_

#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <sstream>

namespace jcs {

  // no, it doesn't make sense to put this here, but that's where it is for now.
  //extern bool verbose;

  float stof(const std::string& rString);
  float stof(const std::string& rString, int n);
  int stoi(const std::string& rString);
  int stoi(const std::string& rString, int n);
  std::string itos(const int i, int width = 0);
  std::string ftos(const double f);
  std::string ftos(const double f, int precision);
  std::string Date(const std::string& date);

  std::vector<std::string> ParseDicomString(const std::string& str);

  template <class T>
  struct member_of : std::binary_function 
  <T, std::basic_string<T>, bool> 
  {
    bool operator()(const T& c, const std::basic_string<T>& s) const
    { return (s.find(c) != std::basic_string<T>::npos); }
  };


  std::string RemoveInvalidChars(const std::string& name);

}

#endif