Kea 2.7.0
isc::util::file Namespace Reference

Classes

struct  Path
 Paths on a filesystem. More...
 

Functions

bool exists (const std::string &path)
 Check if there is a file or directory at the given path.
 
string getContent (const std::string &file_name)
 Get the content of a regular file.
 
bool isDir (const std::string &path)
 Check if there is a directory at the given path.
 
bool isFile (const std::string &path)
 Check if there is a file at the given path.
 

Function Documentation

◆ exists()

bool isc::util::file::exists ( const std::string & path)

Check if there is a file or directory at the given path.

Parameters
pathThe path being checked.
Returns
True if the path points to a file or a directory, false otherwise.

Definition at line 49 of file filesystem.cc.

Referenced by getContent().

◆ getContent()

std::string isc::util::file::getContent ( const std::string & file_name)

Get the content of a regular file.

Parameters
file_nameThe file name.
Returns
The content of the file.
Exceptions
BadValuewhen the file can't be opened or is not a regular one.

Definition at line 32 of file filesystem.cc.

References exists(), isc_throw, and isFile().

Referenced by isc::http::BasicHttpAuthConfig::getFileContent(), and isc::d2::TSIGKeyInfoParser::parse().

+ Here is the call graph for this function:

◆ isDir()

bool isc::util::file::isDir ( const std::string & path)

Check if there is a directory at the given path.

Parameters
pathThe path being checked.
Returns
True if the path points to a directory, false otherwise including if the pointed location does not exist.

Definition at line 55 of file filesystem.cc.

Referenced by isc::asiolink::TlsContextBase::configure(), and isc::db::MySqlConnection::openDatabase().

◆ isFile()

bool isc::util::file::isFile ( const std::string & path)

Check if there is a file at the given path.

Parameters
pathThe path being checked.
Returns
True if the path points to a file, false otherwise including if the pointed location does not exist.

Definition at line 64 of file filesystem.cc.

Referenced by getContent(), isc::db::MySqlConnection::initializeSchema(), and isc::db::PgSqlConnection::initializeSchema().