Spm::Util Namespace Reference


Classes

class  Command
 Launch command and get their output. More...
class  FileNotFoundException
class  Compressed
 Base class for archive manipluation. More...
struct  equalFile
class  Output
class  Debug
class  Directory
class  NetException
struct  urlDetails
class  Object
class  TarFile
 Represent a Tar archive. More...
class  TranslationManager
class  UnknownUserException
class  NullPointerException
class  ArchiveException
class  ZipFile
 Represent a Zip archive. More...

Enumerations

enum  messageType_e { MESSAGE, WARNING, ERROR }
enum  compressor_e { BZ2, GZ, NO }

Functions

int getSocket (const std::string &host, int port) throw (NetException)
 get a connection to a host
void closeSocket (int &fdSocket)
 Close a connection.
void sendTo (int fdSocket, std::string &str) throw (NetException)
 send a string
char * recv (int fdSocket, int &size) throw (NetException)
 Receive a string from network.
urlDetails parseUrl (const std::string &url) throw (NetException)
 Parse an URL.
int getDefaultPortByService (const std::string &serviceName)
 Get the default port of a service.
bool isUrl (const std::string &str)
 Check if a string is an URL.
bool checkPath (const std::string &path)
 Check if a path exist.
void removeDir (const std::string &dir)
 Remove a directory and its content.
bool createDir (const std::string &dir)
 create a directory
std::string getUserName ()
boost::filesystem::path getUserHome ()
boost::filesystem::path getUserHome (const std::string &user) throw (UnknownUserException)
boost::filesystem::path getSpmUserDir ()
boost::filesystem::path getSpmUserDir (const std::string &user)
bool isRoot ()
CompressedgetCompressed (const boost::filesystem::path &file)
 find the Compressed for a archive
void checkSpmDir (const boost::filesystem::path &dir)
 Check the srcPack.
bool haveEnoughRight (const boost::filesystem::path &dir)
 Check that the user have write access to a dir.
std::string intToStr (unsigned long nb)
 Convert a number to a string.
bool checkPath (const boost::filesystem::path &path)
 Check if a path exist.


Enumeration Type Documentation

enum Spm::Util::compressor_e
 

Enumerator:
BZ2 
GZ 
NO 

enum Spm::Util::messageType_e
 

Enumerator:
MESSAGE 
WARNING 
ERROR 


Function Documentation

bool Spm::Util::checkPath const boost::filesystem::path &  path  )  [inline]
 

Check if a path exist.

Parameters:
path The path to check
Returns:
true if the path exist

bool Spm::Util::checkPath const std::string &  path  ) 
 

Check if a path exist.

Parameters:
path The path to check
Returns:
true if the path exist
Deprecated:
Should be replaced by boost::filesystem::path

void Spm::Util::checkSpmDir const boost::filesystem::path &  dir  ) 
 

Check the srcPack.

Parameters:
dir The Spm directory

void Spm::Util::closeSocket int &  fdSocket  ) 
 

Close a connection.

Parameters:
fdSocket The connection to close

bool Spm::Util::createDir const std::string &  dir  ) 
 

create a directory

Parameters:
dir The directory to create
Deprecated:
Should be replaced by boost::filesystem::path

Compressed* Spm::Util::getCompressed const boost::filesystem::path &  file  ) 
 

find the Compressed for a archive

Parameters:
file The archive
Returns:
The Compressed found or NULL if no one is found

int Spm::Util::getDefaultPortByService const std::string &  serviceName  ) 
 

Get the default port of a service.

Parameters:
serviceName The name of the service
Returns:
The standard port of the service

int Spm::Util::getSocket const std::string &  host,
int  port
throw (NetException)
 

get a connection to a host

Parameters:
host The host address
port The port of the connection
Returns:
A connected socket

boost::filesystem::path Spm::Util::getSpmUserDir const std::string &  user  ) 
 

Parameters:
user The username of the user
Returns:
The srcPack directory of the user

boost::filesystem::path Spm::Util::getSpmUserDir  ) 
 

Returns:
The srcPack dir of the user

boost::filesystem::path Spm::Util::getUserHome const std::string &  user  )  throw (UnknownUserException)
 

Parameters:
user The username of the user
Returns:
The home dir of the user

boost::filesystem::path Spm::Util::getUserHome  ) 
 

Returns:
The home dir of the user

std::string Spm::Util::getUserName  ) 
 

Returns:
The name of the user

bool Spm::Util::haveEnoughRight const boost::filesystem::path &  dir  ) 
 

Check that the user have write access to a dir.

Parameters:
dir The directory to check
Returns:
true if the user have write access

std::string Spm::Util::intToStr unsigned long  nb  ) 
 

Convert a number to a string.

Parameters:
nb The number to convert
Returns:
a string representing the number

bool Spm::Util::isRoot  ) 
 

Returns:
true if the user is root

bool Spm::Util::isUrl const std::string &  str  ) 
 

Check if a string is an URL.

Parameters:
str The string to check
Returns:
true if the string is an URL

urlDetails Spm::Util::parseUrl const std::string &  url  )  throw (NetException)
 

Parse an URL.

Parameters:
url The URL to parse
Returns:
The details of the parsed URL

char* Spm::Util::recv int  fdSocket,
int &  size
throw (NetException)
 

Receive a string from network.

Parameters:
fdSocket The socket
size The number of bytes to read (will also contains the number of really readen bytes)
Returns:
A buffer of size bytes

void Spm::Util::removeDir const std::string &  dir  ) 
 

Remove a directory and its content.

Parameters:
dir The directory to remove
Deprecated:
Should be replaced by boost::filesystem::path

void Spm::Util::sendTo int  fdSocket,
std::string &  str
throw (NetException)
 

send a string

Parameters:
fdSocket A connection
str The string to send


Generated on Wed Jul 4 15:27:21 2007 for libSpm by  doxygen 1.4.6