]> Creatis software - gdcm.git/blob - src/gdcmUtil.h
* Bugs fix for the Windows build with VC6
[gdcm.git] / src / gdcmUtil.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmUtil.h,v $
5   Language:  C++
6   Date:      $Date: 2004/11/09 11:21:32 $
7   Version:   $Revision: 1.41 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #ifndef GDCMUTIL_H
20 #define GDCMUTIL_H
21
22 #include "gdcmCommon.h"
23 #include <vector>
24 #include <string>
25
26 namespace gdcm 
27 {
28 /**
29  * \defgroup Globals Utility functions
30  * \brief    Here are some utility functions, belonging to the Util class,
31  *           dealing with strings, file names... that can be called
32  *           from anywhere by whomsoever they can help.
33  */
34
35 //-----------------------------------------------------------------------------
36
37 class GDCM_EXPORT Util
38 {
39 public:
40    static std::string Format(const char* format, ...);
41    static void        Tokenize (const std::string& str,
42                                 std::vector<std::string>& tokens,
43                                 const std::string& delimiters = " ");
44    static int         CountSubstring (const std::string& str,
45                                       const std::string& subStr);       
46
47    static std::string CreateCleanString(std::string const & s);
48    static std::string NormalizePath(std::string const & name);
49    static std::string GetPath(std::string const &fullName);
50    static std::string GetName(std::string const &fullName);
51
52    static std::string DicomString(const char* s, size_t l);
53    static std::string DicomString(const char* s);
54 };
55
56    template <class T> 
57    GDCM_EXPORT std::ostream& binary_write(std::ostream& os, const T& val);
58    GDCM_EXPORT std::ostream& binary_write(std::ostream& os, const uint16_t& val);
59    GDCM_EXPORT std::ostream& binary_write(std::ostream& os, const uint32_t& val);
60    GDCM_EXPORT std::ostream& binary_write(std::ostream& os, const char* val);
61    GDCM_EXPORT std::ostream& binary_write(std::ostream& os, std::string const & val);
62 } // end namespace gdcm
63 //-----------------------------------------------------------------------------
64 #endif