FOSSology  4.4.0
Open Source License Compliance by Open Source Software
fo Namespace Reference

fo namespace holds the FOSSology library functions. More...

Classes

class  File
 Class to handle file related operations. More...
 
class  AgentDatabaseHandler
 Database handler for agents. More...
 
class  DbManagerStructDeleter
 DB manager deleter (for shared pointer) More...
 
class  DbManager
 DB wrapper for agents. More...
 
class  PGresultDeleter
 PGresult deleter (for shared pointer) More...
 
class  QueryResult
 Wrapper for DB result. More...
 

Functions

std::string getStringFromFile (const char *filename, const unsigned long int maximumBytes)
 Reads the content of a file and return it as a string. More...
 
std::string getStringFromFile (std::string const &filename, const unsigned long int maximumBytes)
 
unsigned long stringToUnsignedLong (const char *string)
 
bool stringToBool (const char *string)
 
icu::UnicodeString recodeToUnicode (const std::string &input)
 

Detailed Description

fo namespace holds the FOSSology library functions.

Function Documentation

◆ getStringFromFile() [1/2]

std::string fo::getStringFromFile ( const char *  filename,
const unsigned long int  maximumBytes 
)

Reads the content of a file and return it as a string.

Read the content of the file defined by the filename. Function also limits the length of the file content by using maximumBytes.

Parameters
filenamePath of the file to read.
maximumBytesMaximum length to read (set -1 to read full length).
Returns
The file content limited by maximumBytes as string.
Todo:
respect limit of maximumBytes

Definition at line 34 of file files.cc.

◆ getStringFromFile() [2/2]

std::string fo::getStringFromFile ( std::string const &  filename,
const unsigned long int  maximumBytes 
)

Definition at line 69 of file files.cc.

◆ recodeToUnicode()

icu::UnicodeString fo::recodeToUnicode ( const std::string &  input)

Remove all non-UTF8 characters from a string.

Parameters
inputThe string to be recoded
Returns
Unicode string with invalid characters removed

Definition at line 46 of file libfossUtils.cc.

◆ stringToBool()

bool fo::stringToBool ( const char *  str)

Translates a string to boolean type.

Parameters
strString to be translated
Returns
Translated boolean value

Definition at line 32 of file libfossUtils.cc.

◆ stringToUnsignedLong()

unsigned long fo::stringToUnsignedLong ( const char *  string)

Translates a string to unsigned long type.

Parameters
stringString to be translated
Returns
Translated unsigned long value

Definition at line 20 of file libfossUtils.cc.