Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2004/10/09 02:57:12 $
- Version: $Revision: 1.52 $
+ 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 Format(const char* format, ...)
+std::string Util::Format(const char* format, ...)
{
char buffer[2048];
va_list args;
* \ingroup Globals
* \brief Because not available in C++ (?)
*/
-void Tokenize (const std::string& str,
+void Util::Tokenize (const std::string& str,
std::vector<std::string>& tokens,
const std::string& delimiters)
{
* Counts the number of occurences of a substring within a string
*/
-int 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
* to avoid corrupting the terminal of invocation when printing)
* @param s string to remove non printable characters from
*/
-std::string CreateCleanString(std::string s)
+std::string Util::CreateCleanString(std::string s)
{
std::string str = s;
* \brief Add a SEPARATOR to the end of the name is necessary
* @param name file/directory name to normalize
*/
-void NormalizePath(std::string &name)
+void Util::NormalizePath(std::string &name)
{
const char SEPARATOR_X = '/';
const char SEPARATOR_WIN = '\\';
* \brief Get the (directory) path from a full path file name
* @param fullName file/directory name to extract Path from
*/
-std::string GetPath(std::string &fullName)
+std::string Util::GetPath(std::string &fullName)
{
int pos1 = fullName.rfind("/");
int pos2 = fullName.rfind("\\");
* \brief Get the (last) name of a full path file name
* @param fullName file/directory name to extract end name from
*/
-std::string GetName(std::string &fullName)
+std::string Util::GetName(std::string &fullName)
{
int fin = fullName.length()-1;
char a =fullName.c_str()[fin];
return lastName;
}
+
+} // end namespace gdcm
+