Data Structures | |
class | DefaultDistribution |
Default distro handler. More... | |
class | DefaultPackager |
Default packager which does not detect anything. More... | |
class | Distribution |
Distribution specific code. More... | |
class | DistributionRegistry |
Manages list of all distribution specific detector classes. More... | |
class | EqueryPackager |
Adapter for the equery command. More... | |
class | FedoraCoreDistribution |
Custom handler for Fedora Core distros. More... | |
class | ForkAndPipe |
Fork process and automatically create pipes. More... | |
class | GentooDistribution |
Handler for the Gentoo distro. More... | |
class | GentooFindPackager |
Fake packager adapter for Gentoo. More... | |
class | LinuxAdvancedFeatures |
Storage for Linux specific info. More... | |
class | LinuxDetector |
Linux detector class. More... | |
class | Packager |
Base class for all packagers. More... | |
class | RPMPackager |
Adapter for the RPM command. More... | |
class | AdvancedFeatures |
Empty class which enforces realtions between various implementations of AdvancedFeatures for various OSes. More... | |
class | BasicFeatures |
Storage class for common OS features. These features are supported by all detectors. More... | |
class | BeenDisk |
This class stores information about drive space available for BEEN to use. More... | |
class | CheckedResult |
Provides means to return two values from function - call status and return value. More... | |
class | Detector |
Base class for all detectors. Each detector for specific OS is derived from this class. More... | |
class | DiskDrive |
Storage class for disk drive related data. More... | |
class | DiskPartition |
Storage class for all partition related data. More... | |
class | Memory |
Storage class for all memory related data. More... | |
class | MessageReporter |
Class which provides simple way to report messages. More... | |
class | NetworkAdapter |
Storage for all network related data. More... | |
class | OperatingSystem |
This class stores all OS specific data. More... | |
class | Processor |
Storage class for all CPU related data. More... | |
class | Product |
Storage class for installed software product (application) related data. More... | |
class | XMLElement |
Basic class for all nodes in XML file. More... | |
class | XMLValueElement |
Node in XML file which contains value of given type. More... | |
class | XMLOutputFile |
Class which represent simple XML files. This class Only allows writing to such files (no parsing). More... | |
Typedefs | |
typedef ::std::string | String |
ASCII string. | |
typedef ::std::stringstream | StringStream |
ASCII string stream. | |
typedef ::std::istringstream | IStringStream |
ASCII string input stream. | |
typedef ::std::ostringstream | OStringStream |
ASCII string output stream. | |
typedef ::std::fstream | FStream |
ASCII file stream. | |
typedef ::std::ifstream | IFStream |
ASCII file input stream. | |
typedef ::std::ofstream | OFStream |
ASCII file output stream. | |
typedef ::std::ostream | OStream |
ASCII output stream. | |
typedef ::std::istream | IStream |
ASCII input stream. | |
typedef ::std::iostream | IOStream |
ASCII input/output stream. | |
typedef char | Char |
ASCII character. | |
Functions | |
bool | ReadLines (const char *file_name, std::vector< String > &lines) |
Read all lines from the text file. | |
String | GetFieldName (const String &line, size_t *ends_at=NULL, const String &end=TXT(":"), const size_t start_at=0) |
Read name of the filed on the current line. | |
bool | BeginsWith (const String &str, const String &what) |
Test if one string begins with another. | |
template<typename T> | |
bool | GetFieldValue (const std::string &line, const size_t index, T &result, const size_t start_at=0, const char *delims="\t ") |
String | GetFsHumanName (long fs_type) |
Get human readable name of the filesystem. | |
void | AutoCerr (int result, const String &message) |
Write error message to error output. | |
String | GetInterfaceTypeByID (unsigned short id) |
Get name of the interface type by its HW ID. | |
String | GetErrorName (int error_id) |
Get name of an error with given error number. | |
String | GetLastErrorName (void) |
Get name of an error. | |
int | GetLastErrorID (void) |
Get error number. | |
bool | FileExists (const char *filename) |
Test if given file exists. | |
bool | FileTestPermissions (const char *filename, int flags) |
Test permissions of the file. | |
template<typename T> | |
String | ConvertToXMLString (const T &value) |
Convert given value to the string. | |
String | ConvertToXMLString (const String &value) |
Convert string to XML-friendly version (all special chars are escaped). | |
Variables | |
const int | PERMISSIONS_READ = R_OK |
Read file permission bit. | |
const int | PERMISSIONS_WRITE = W_OK |
Write file permission bit. | |
const int | PERMISSIONS_EXECUTE = X_OK |
Execute file permission bit. | |
std::ostream & | Cout = std::cout |
ACSII standard output stream. | |
std::ostream & | Cerr = std::cerr |
ASCII standard input stream. | |
std::istream & | Cin = std::cin |
ASCII standard input stream. | |
std::ostream & | Cout |
ACSII standard output stream. | |
std::ostream & | Cerr |
ASCII standard input stream. | |
std::istream & | Cin |
ASCII standard input stream. | |
const Char | DefaultEncoding [] = TXT("US-ASCII") |
Default encoding of the output. |
typedef ::std::string hwdet::String |
ASCII string.
typedef ::std::stringstream hwdet::StringStream |
ASCII string stream.
typedef ::std::istringstream hwdet::IStringStream |
ASCII string input stream.
typedef ::std::ostringstream hwdet::OStringStream |
ASCII string output stream.
typedef ::std::fstream hwdet::FStream |
ASCII file stream.
typedef ::std::ifstream hwdet::IFStream |
ASCII file input stream.
typedef ::std::ofstream hwdet::OFStream |
ASCII file output stream.
typedef ::std::ostream hwdet::OStream |
ASCII output stream.
typedef ::std::istream hwdet::IStream |
ASCII input stream.
typedef ::std::iostream hwdet::IOStream |
ASCII input/output stream.
typedef char hwdet::Char |
ASCII character.
bool hwdet::ReadLines | ( | const char * | file_name, | |
std::vector< String > & | lines | |||
) |
Read all lines from the text file.
This will read all lines from the text file into given vector.
file_name | Name of the file to read. | |
lines | Vector which will receive lines read from the file. Note that lines are added at the end of the vector and data from vector are not removed automatically. |
String hwdet::GetFieldName | ( | const String & | line, | |
size_t * | ends_at = NULL , |
|||
const String & | end = TXT(":") , |
|||
const size_t | start_at = 0 | |||
) |
Read name of the filed on the current line.
Retrieve name of the current line. Name is string that does not contain white-space characters at the beginning or at the end (white-spaces in the middle are allowed).
line | String which contains data and name. | |
ends_at | Pointer to the variable which will receive index of the first character after the separator string. Set this to NULL if you don't need this information. | |
end | String which marks end of the field name. Default value is ":" which is suitable for most of the files in the /proc directory. | |
start_at | First character of the name. May be whitespace. Default value is 0. |
Test if one string begins with another.
str | String to test. | |
what | String to search for. |
bool hwdet::GetFieldValue | ( | const std::string & | line, | |
const size_t | index, | |||
T & | result, | |||
const size_t | start_at = 0 , |
|||
const char * | delims = "\t " | |||
) |
Retrieve value of the column with given index. Columns can be separated by custom delimiter characters. Value will be automatically converted to the target type.
line | String which contains requested value. | |
index | Index of the column which contains given value. First column has index of 1. | |
start_at | Index of the first character (or some delimiter directly before) of the first column. | |
delims | Delimiters that are between columns. Each character of this string is threated as a delimiter. | |
result | Reference to the variable which will receive value of the given column. Value is automatically converted to the target type via the stream operator >>. If an error occured during conversion or if column with given index does not exist, original value remains unchanged. |
String hwdet::GetFsHumanName | ( | long | fs_type | ) |
Get human readable name of the filesystem.
Return human-readable name of the filesystem with given id.
fs_type | Type of the filesystem from the statfs structure (f_type field). |
coreutils
' stat
. Original credits due to Michael Meskes. void hwdet::AutoCerr | ( | int | result, | |
const String & | message | |||
) |
Write error message to error output.
This will check if syscall completed successfully and in case of error output simple error message with error description to the error output stream.
result | Return value of the syscall. Call is assumed to be failed if this value is -1, so this method cannot be used for calls where -1 is valid return value. | |
message | Message to write alongside error description. |
String hwdet::GetInterfaceTypeByID | ( | unsigned short | id | ) |
Get name of the interface type by its HW ID.
Get human readable name of the network interface.
id | Interface type as determined by the ioctl. |
String hwdet::GetErrorName | ( | int | error_id | ) |
Get name of an error with given error number.
error_id | Error number (value of the errno). |
String hwdet::GetLastErrorName | ( | void | ) |
Get name of an error.
errno
global variable. int hwdet::GetLastErrorID | ( | void | ) |
Get error number.
errno
global. bool hwdet::FileExists | ( | const char * | filename | ) |
Test if given file exists.
filename | Name of the file to test. |
bool hwdet::FileTestPermissions | ( | const char * | filename, | |
int | flags | |||
) |
Test permissions of the file.
filename | Name of the file to test. | |
flags | Mask containing one or more of the PERMISSION_READ, PERMISSION_WRITE, PERMISSION_EXECUTE flags which specify permissions to test. In addition, file existence is checked. |
true
if file exists and all specified permissions are present, false
otherwise. String hwdet::ConvertToXMLString | ( | const T & | value | ) | [inline] |
Convert given value to the string.
value | Value to convert. |
Convert string to XML-friendly version (all special chars are escaped).
value | String to convert. |
const int hwdet::PERMISSIONS_READ = R_OK |
Read file permission bit.
const int hwdet::PERMISSIONS_WRITE = W_OK |
Write file permission bit.
const int hwdet::PERMISSIONS_EXECUTE = X_OK |
Execute file permission bit.
std::ostream& hwdet::Cout = std::cout |
ACSII standard output stream.
std::ostream& hwdet::Cerr = std::cerr |
ASCII standard input stream.
std::istream& hwdet::Cin = std::cin |
ASCII standard input stream.
std::ostream& hwdet::Cout |
ACSII standard output stream.
std::ostream& hwdet::Cerr |
ASCII standard input stream.
std::istream& hwdet::Cin |
ASCII standard input stream.
const Char hwdet::DefaultEncoding[] = TXT("US-ASCII") |
Default encoding of the output.