00001 /* 00002 * Copyright (C) 2009, Edmundo Albuquerque de Souza e Silva. 00003 * 00004 * This file may be distributed under the terms of the Q Public License 00005 * as defined by Trolltech AS of Norway and appearing in the file 00006 * LICENSE.QPL included in the packaging of this file. 00007 * 00008 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING 00009 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00010 * PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00011 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00012 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00013 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00014 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00015 * 00016 */ 00017 00018 #ifndef __OBJECTINFO_H__ 00019 #define __OBJECTINFO_H__ 00020 00021 #include <string> 00022 00023 using namespace std; 00024 00025 #include "RioInterfaceTypes.h" 00026 00027 #define MD5SIZE 33 00028 00029 // Time and data structure 00030 typedef struct 00031 { 00032 short Year; 00033 short Month; 00034 short DayOfWeek; 00035 short Day; 00036 short Hour; 00037 short Minute; 00038 } AccessTime; 00039 00040 class ObjectInfo 00041 { 00042 private: 00043 string name; 00044 string path; //caminho relativo (usado no ls) 00045 string fullPath; //caminho absoluto 00046 short type; 00047 short permission; 00048 string owner; 00049 string group; 00050 RioObjectSize size; 00051 AccessTime time; 00052 // Novo campo com a taxa de transmissao do video (somente aplicado a 00053 // arquivos mpeg). 00054 unsigned int VideoRate; 00055 00056 char md5sum[MD5SIZE]; 00057 00058 public: 00059 // Construtor criado para inicializar os campos do objeto com valores 00060 // default (para evitar os erros do valgrind de campos nao 00061 // inicializados). 00062 ObjectInfo(); 00063 bool operator<( ObjectInfo ) const; 00064 void setName( string ); 00065 void setPath( string ); 00066 void setFullPath( string ); 00067 void setNames( const char *, const char * ); 00068 void setType( short ); 00069 void setPermission( short ); 00070 void setOwner( string ); 00071 void setGroup( string ); 00072 void setSize( RioObjectSize ); 00073 void setTime( AccessTime ); 00074 00075 void setMd5sum( char * ); 00076 00077 string getName(); 00078 string getPath(); 00079 string getFullPath(); 00080 short getType(); 00081 short getPermission(); 00082 string getOwner(); 00083 string getGroup(); 00084 RioObjectSize getSize(); 00085 AccessTime getTime(); 00086 00087 void getMd5sum( char * ); 00088 00089 string getFullName(); 00090 bool isDir(); 00091 bool isHidden(); 00092 00093 // Novas funcoes para obter e alterar o campo VideoRate, que define a 00094 // taxa de transmissao do video. 00095 /** 00096 * setVideoRate retorna a taxa de transmissao (em Kbps) do video. 00097 * @param nova taxa de transmissao de video. 00098 */ 00099 void setVideoRate( unsigned int ); 00100 00101 /** 00102 * getVideoRate retorna a taxa de transmissao (em Kbps) do video. 00103 * @return taxa de transmissao de video. 00104 */ 00105 unsigned int getVideoRate(); 00106 00107 // File Type Constants 00108 static const short FILE_TYPE_INVALID = 0; 00109 static const short FILE_TYPE_DIRECTORY = 1; 00110 static const short FILE_TYPE_DATA = 2; 00111 static const short FILE_TYPE_DATA_LINK = 3; 00112 static const short FILE_TYPE_DIR_LINK = 4; 00113 static const short FILE_TYPE_BROKEN_LINK = 5; 00114 }; 00115 00116 #endif