]> Creatis software - gdcm.git/blobdiff - src/gdcmUtil.cxx
ENH: Adding 'gdcm' namespace. Be nice with me this was a ~13000 lines patch. Also...
[gdcm.git] / src / gdcmUtil.cxx
index b4907d912c4b4a169b6c60081807241cf9fdfd82..6e6f9f3df4d707273375048b852b6f89018abd58 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmUtil.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/10 00:42:55 $
-  Version:   $Revision: 1.53 $
+  Date:      $Date: 2004/10/12 04:35:48 $
+  Version:   $Revision: 1.54 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #include "gdcmUtil.h"
 #include "gdcmDebug.h"
 
+#include <stdarg.h>  //only included in implementation file
+#include <stdio.h>   //only included in implementation file
+
+namespace gdcm 
+{
 
 /**
  * \ingroup Globals
  *     << std::hex <<  element;
  * buf.str();
  */
-#include <stdarg.h>  //only included in implementation file
-#include <stdio.h>   //only included in implementation file
 
-std::string gdcmUtil::Format(const char* format, ...)
+std::string Util::Format(const char* format, ...)
 {
    char buffer[2048];
    va_list args;
@@ -50,7 +53,7 @@ std::string gdcmUtil::Format(const char* format, ...)
  * \ingroup Globals
  * \brief Because not available in C++ (?)
  */
-void gdcmUtil::Tokenize (const std::string& str,
+void Util::Tokenize (const std::string& str,
                std::vector<std::string>& tokens,
                const std::string& delimiters)
 {
@@ -70,7 +73,7 @@ void gdcmUtil::Tokenize (const std::string& str,
  *        Counts the number of occurences of a substring within a string
  */
  
-int gdcmUtil::CountSubstring (const std::string& str,
+int Util::CountSubstring (const std::string& str,
                     const std::string& subStr)
 {
    int count = 0;   // counts how many times it appears
@@ -96,7 +99,7 @@ int gdcmUtil::CountSubstring (const std::string& str,
  *         to avoid corrupting the terminal of invocation when printing)
  * @param s string to remove non printable characters from
  */
-std::string gdcmUtil::CreateCleanString(std::string s)
+std::string Util::CreateCleanString(std::string s)
 {
    std::string str = s;
 
@@ -127,7 +130,7 @@ std::string gdcmUtil::CreateCleanString(std::string s)
  * \brief   Add a SEPARATOR to the end of the name is necessary
  * @param name file/directory name to normalize 
  */
-void gdcmUtil::NormalizePath(std::string &name)
+void Util::NormalizePath(std::string &name)
 {
    const char SEPARATOR_X      = '/';
    const char SEPARATOR_WIN    = '\\';
@@ -145,7 +148,7 @@ void gdcmUtil::NormalizePath(std::string &name)
  * \brief   Get the (directory) path from a full path file name
  * @param   fullName file/directory name to extract Path from
  */
-std::string gdcmUtil::GetPath(std::string &fullName)
+std::string Util::GetPath(std::string &fullName)
 {
    int pos1 = fullName.rfind("/");
    int pos2 = fullName.rfind("\\");
@@ -166,7 +169,7 @@ std::string gdcmUtil::GetPath(std::string &fullName)
  * \brief   Get the (last) name of a full path file name
  * @param   fullName file/directory name to extract end name from
  */
-std::string gdcmUtil::GetName(std::string &fullName)
+std::string Util::GetName(std::string &fullName)
 {   
    int fin = fullName.length()-1;
    char a =fullName.c_str()[fin];
@@ -192,3 +195,6 @@ std::string gdcmUtil::GetName(std::string &fullName)
 
   return lastName;
 } 
+
+} // end namespace gdcm
+