#include <ObjectInfo.h>
Public Member Functions | |
ObjectInfo () | |
bool | operator< (ObjectInfo) const |
void | setName (string) |
void | setPath (string) |
void | setFullPath (string) |
void | setNames (const char *, const char *) |
setNames preenche os atributos name, path e fullPath da classe ObjectInfo de acordo com os dados fornecidos nos par�metros ObjectName e fullPath. | |
void | setType (short) |
void | setPermission (short) |
void | setOwner (string) |
void | setGroup (string) |
void | setSize (RioObjectSize) |
void | setTime (AccessTime) |
void | setMd5sum (char *) |
string | getName () |
string | getPath () |
string | getFullPath () |
short | getType () |
short | getPermission () |
string | getOwner () |
string | getGroup () |
RioObjectSize | getSize () |
AccessTime | getTime () |
void | getMd5sum (char *) |
string | getFullName () |
fullName retorna a concatena de path e name uma �nica string | |
bool | isDir () |
isDir verifica se a inst�ncia de ObjectInfo representa um diret�rio ou link pra diret�rio e retorna true caso verdadeiro. | |
bool | isHidden () |
isHidden verifica se a inst�ncia de ObjectInfo � de um arquivo oculto, isto �, o nome do arquivo/diret�rio come�a por um ponto. | |
void | setVideoRate (unsigned int) |
setVideoRate retorna a taxa de transmissao (em Kbps) do video. | |
unsigned int | getVideoRate () |
getVideoRate retorna a taxa de transmissao (em Kbps) do video. | |
Static Public Attributes | |
static const short | FILE_TYPE_INVALID = 0 |
static const short | FILE_TYPE_DIRECTORY = 1 |
static const short | FILE_TYPE_DATA = 2 |
static const short | FILE_TYPE_DATA_LINK = 3 |
static const short | FILE_TYPE_DIR_LINK = 4 |
static const short | FILE_TYPE_BROKEN_LINK = 5 |
Private Attributes | |
string | name |
string | path |
string | fullPath |
short | type |
short | permission |
string | owner |
string | group |
RioObjectSize | size |
AccessTime | time |
unsigned int | VideoRate |
char | md5sum [MD5SIZE] |
Definition at line 40 of file ObjectInfo.h.
ObjectInfo::ObjectInfo | ( | ) |
Definition at line 25 of file ObjectInfo.cpp.
00026 { 00027 // Inicializa os campos do objeto. 00028 this->name = ""; 00029 this->path = ""; 00030 this->fullPath = ""; 00031 this->type = 0; 00032 this->permission = 0; 00033 this->owner = ""; 00034 this->group = ""; 00035 this->size = 0; 00036 memset( &this->time, 0, sizeof( this->time ) ); 00037 this->VideoRate = 0; 00038 this->md5sum[0] = '\0'; 00039 }
string ObjectInfo::getFullName | ( | ) |
fullName retorna a concatena de path e name uma �nica string
Definition at line 162 of file ObjectInfo.cpp.
string ObjectInfo::getFullPath | ( | ) |
Definition at line 119 of file ObjectInfo.cpp.
00120 { 00121 return fullPath; 00122 }
string ObjectInfo::getGroup | ( | void | ) |
Definition at line 139 of file ObjectInfo.cpp.
00140 { 00141 return group; 00142 }
void ObjectInfo::getMd5sum | ( | char * | md5sum | ) |
Definition at line 154 of file ObjectInfo.cpp.
string ObjectInfo::getName | ( | ) |
Definition at line 109 of file ObjectInfo.cpp.
00110 { 00111 return name; 00112 }
string ObjectInfo::getOwner | ( | void | ) |
Definition at line 134 of file ObjectInfo.cpp.
00135 { 00136 return owner; 00137 }
string ObjectInfo::getPath | ( | void | ) |
Definition at line 114 of file ObjectInfo.cpp.
00115 { 00116 return path; 00117 }
short ObjectInfo::getPermission | ( | ) |
Definition at line 129 of file ObjectInfo.cpp.
00130 { 00131 return permission; 00132 }
RioObjectSize ObjectInfo::getSize | ( | void | ) |
Definition at line 144 of file ObjectInfo.cpp.
00145 { 00146 return size; 00147 }
AccessTime ObjectInfo::getTime | ( | ) |
Definition at line 149 of file ObjectInfo.cpp.
00150 { 00151 return time; 00152 }
short ObjectInfo::getType | ( | void | ) |
Definition at line 124 of file ObjectInfo.cpp.
00125 { 00126 return type; 00127 }
unsigned int ObjectInfo::getVideoRate | ( | ) |
getVideoRate retorna a taxa de transmissao (em Kbps) do video.
Definition at line 254 of file ObjectInfo.cpp.
00255 { 00256 return VideoRate; 00257 }
bool ObjectInfo::isDir | ( | void | ) |
isDir verifica se a inst�ncia de ObjectInfo representa um diret�rio ou link pra diret�rio e retorna true caso verdadeiro.
Definition at line 177 of file ObjectInfo.cpp.
00178 { 00179 return ( ( this->type == FILE_TYPE_DIRECTORY ) || 00180 ( this->type == FILE_TYPE_DIR_LINK ) 00181 ); 00182 }
bool ObjectInfo::isHidden | ( | ) |
isHidden verifica se a inst�ncia de ObjectInfo � de um arquivo oculto, isto �, o nome do arquivo/diret�rio come�a por um ponto.
Retorna true caso verdadeiro
Definition at line 188 of file ObjectInfo.cpp.
bool ObjectInfo::operator< | ( | ObjectInfo | obj | ) | const |
Definition at line 41 of file ObjectInfo.cpp.
00042 { 00043 string this_fullpath = ((ObjectInfo *)this)->getFullPath(); 00044 string obj_fullpath = obj.getFullPath(); 00045 // In some cases, the compiler can't find a match to the tolower function, 00046 // due to its prototype using int values, not char values, which are used on 00047 // the string. Due to this, we force a typecast of the tolower function, to 00048 // a pointer to a function that receives an int and returns an int, which 00049 // satisfies the compiler 00050 transform( this_fullpath.begin(), this_fullpath.end(), 00051 this_fullpath.begin(), ( int(*)(int) ) tolower ); 00052 transform( obj_fullpath.begin(), obj_fullpath.end(), 00053 obj_fullpath.begin(), ( int(*)(int) ) tolower ); 00054 return( this_fullpath < obj_fullpath ); 00055 }
void ObjectInfo::setFullPath | ( | string | fullPath | ) |
Definition at line 66 of file ObjectInfo.cpp.
void ObjectInfo::setGroup | ( | string | group | ) |
Definition at line 86 of file ObjectInfo.cpp.
void ObjectInfo::setMd5sum | ( | char * | md5sum | ) |
void ObjectInfo::setName | ( | string | name | ) |
Definition at line 56 of file ObjectInfo.cpp.
void ObjectInfo::setNames | ( | const char * | objectName, | |
const char * | fullPath | |||
) |
setNames preenche os atributos name, path e fullPath da classe ObjectInfo de acordo com os dados fornecidos nos par�metros ObjectName e fullPath.
fullPath sempre conter� o caminho completo do objeto; name comter� apenas o nome do objeto; path conter� o caminho relativo do objeto (relativo ao diret�rio corrente)
Definition at line 206 of file ObjectInfo.cpp.
00207 { 00208 char *lastName, *freelastName; 00209 char *path; 00210 00211 freelastName = strdup( objectName ); 00212 lastName = strrchr( freelastName, '/' ); 00213 path = strdup( objectName ); 00214 00215 if( ( lastName != NULL ) && strcmp( objectName, "/" ) ) 00216 { 00217 lastName++; 00218 this->name = lastName; 00219 00220 lastName = strrchr( path, '/' ); 00221 lastName++; 00222 *lastName = '\0'; 00223 this->path = path; 00224 } 00225 else 00226 { 00227 this->name = objectName; 00228 this->path.clear(); 00229 } 00230 00231 if( ( fullPath != NULL ) && 00232 ( (int)strlen( fullPath ) > 0 ) && 00233 ( objectName[0] != '/' ) 00234 ) // objectName n�o � caminho absoluto 00235 { 00236 this->fullPath = strdup( fullPath ); 00237 00238 if( strcmp( fullPath, "/" ) != 0 ) 00239 this->fullPath += "/"; 00240 00241 this->fullPath += strdup( objectName ); 00242 } 00243 else 00244 this->fullPath = strdup( objectName ); 00245 00246 free( freelastName ); 00247 free( path ); 00248 }
void ObjectInfo::setOwner | ( | string | owner | ) |
Definition at line 81 of file ObjectInfo.cpp.
void ObjectInfo::setPath | ( | string | path | ) |
Definition at line 61 of file ObjectInfo.cpp.
void ObjectInfo::setPermission | ( | short | permission | ) |
Definition at line 76 of file ObjectInfo.cpp.
00077 { 00078 this->permission = permission; 00079 }
void ObjectInfo::setSize | ( | RioObjectSize | size | ) |
Definition at line 91 of file ObjectInfo.cpp.
void ObjectInfo::setTime | ( | AccessTime | time | ) |
Definition at line 96 of file ObjectInfo.cpp.
00097 { 00098 memcpy( (void *) &(this->time), (void *) &time, sizeof( AccessTime ) ); 00099 }
void ObjectInfo::setType | ( | short | type | ) |
Definition at line 71 of file ObjectInfo.cpp.
void ObjectInfo::setVideoRate | ( | unsigned int | VideoRate | ) |
setVideoRate retorna a taxa de transmissao (em Kbps) do video.
nova | taxa de transmissao de video. |
Definition at line 260 of file ObjectInfo.cpp.
const short ObjectInfo::FILE_TYPE_BROKEN_LINK = 5 [static] |
Definition at line 113 of file ObjectInfo.h.
const short ObjectInfo::FILE_TYPE_DATA = 2 [static] |
Definition at line 110 of file ObjectInfo.h.
const short ObjectInfo::FILE_TYPE_DATA_LINK = 3 [static] |
Definition at line 111 of file ObjectInfo.h.
const short ObjectInfo::FILE_TYPE_DIR_LINK = 4 [static] |
Definition at line 112 of file ObjectInfo.h.
const short ObjectInfo::FILE_TYPE_DIRECTORY = 1 [static] |
Definition at line 109 of file ObjectInfo.h.
const short ObjectInfo::FILE_TYPE_INVALID = 0 [static] |
Definition at line 108 of file ObjectInfo.h.
string ObjectInfo::fullPath [private] |
Definition at line 45 of file ObjectInfo.h.
string ObjectInfo::group [private] |
Definition at line 49 of file ObjectInfo.h.
char ObjectInfo::md5sum[MD5SIZE] [private] |
Definition at line 56 of file ObjectInfo.h.
string ObjectInfo::name [private] |
Definition at line 43 of file ObjectInfo.h.
string ObjectInfo::owner [private] |
Definition at line 48 of file ObjectInfo.h.
string ObjectInfo::path [private] |
Definition at line 44 of file ObjectInfo.h.
short ObjectInfo::permission [private] |
Definition at line 47 of file ObjectInfo.h.
RioObjectSize ObjectInfo::size [private] |
Definition at line 50 of file ObjectInfo.h.
AccessTime ObjectInfo::time [private] |
Definition at line 51 of file ObjectInfo.h.
short ObjectInfo::type [private] |
Definition at line 46 of file ObjectInfo.h.
unsigned int ObjectInfo::VideoRate [private] |
Definition at line 54 of file ObjectInfo.h.