CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
string.h File Reference
#include <stdint.h>
#include <sys/time.h>
#include <cstdio>
#include <map>
#include <string>
#include <vector>
Include dependency graph for string.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


std::string StringifyBool (const bool value)
std::string StringifyInt (const int64_t value)
std::string StringifyUint (const uint64_t value)
std::string StringifyByteAsHex (const unsigned char value)
std::string StringifyDouble (const double value)
std::string StringifyTime (const time_t seconds, const bool utc)
std::string StringifyTimeval (const timeval value)
std::string RfcTimestamp ()
std::string IsoTimestamp ()
std::string WhitelistTimestamp (time_t when)
time_t IsoTimestamp2UtcTime (const std::string &iso8601)
int64_t String2Int64 (const std::string &value)
uint64_t String2Uint64 (const std::string &value)
bool String2Uint64Parse (const std::string &value, uint64_t *result)
void String2Uint64Pair (const std::string &value, uint64_t *a, uint64_t *b)
bool HasPrefix (const std::string &str, const std::string &prefix, const bool ignore_case)
bool HasSuffix (const std::string &str, const std::string &suffix, const bool ignore_case)
std::vector< std::string > SplitString (const std::string &str, const char delim, const unsigned max_chunks=0)
std::string JoinStrings (const std::vector< std::string > &strings, const std::string &joint)
void ParseKeyvalMem (const unsigned char *buffer, const unsigned buffer_size, std::map< char, std::string > *content)
bool ParseKeyvalPath (const std::string &filename, std::map< char, std::string > *content)
std::string GetLineMem (const char *text, const int text_size)
bool GetLineFile (FILE *f, std::string *line)
bool GetLineFd (const int fd, std::string *line)
std::string Trim (const std::string &raw, bool trim_newline=false)
std::string ToUpper (const std::string &mixed_case)
std::string ReplaceAll (const std::string &haystack, const std::string &needle, const std::string &replace_by)
std::string Tail (const std::string &source, unsigned num_lines)
std::string Base64 (const std::string &data)
std::string Base64Url (const std::string &data)
bool Debase64 (const std::string &data, std::string *decoded)
std::string GetGMTimestamp (const std::string &format="%Y-%m-%d %H:%M:%S")

Function Documentation

std::string Base64 ( const std::string &  data)
std::string Base64Url ( const std::string &  data)
bool Debase64 ( const std::string &  data,
std::string *  decoded 
std::string GetGMTimestamp ( const std::string &  format)

Get UTC Time.

formatformat if timestamp (YYYY-MM-DD HH:MM:SS by default)
a timestamp string on success, empty string on failure

Definition at line 585 of file

Referenced by swissknife::CommandGc::Main(), swissknife::Ingest::Main(), main(), swissknife::CommandSync::Main(), StatisticsDatabase::StoreGCStatistics(), and StatisticsDatabase::StorePublishStatistics().

Here is the caller graph for this function:

bool GetLineFd ( const int  fd,
std::string *  line 

Definition at line 397 of file

Referenced by FuseMain(), publish::ServerLockFile::IsLocked(), BashOptionsManager::ParsePath(), manifest::Reflog::ReadChecksum(), and publish::SetInConfig().

Here is the caller graph for this function:

std::string GetLineMem ( const char *  text,
const int  text_size 
bool HasPrefix ( const std::string &  str,
const std::string &  prefix,
const bool  ignore_case 
std::string IsoTimestamp ( )

Current time in format YYYYMMDDTHHMMSSZ. Used in AWS4 requests.

Definition at line 149 of file

Referenced by s3fanout::S3FanoutManager::MkV4Authz().

Here is the caller graph for this function:

time_t IsoTimestamp2UtcTime ( const std::string &  iso8601)

Parses a timstamp of the form YYYY-MM-DDTHH:MM:SSZ Return 0 on error

Definition at line 198 of file

Referenced by MountPoint::DetermineRootHash().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string JoinStrings ( const std::vector< std::string > &  strings,
const std::string &  joint 
void ParseKeyvalMem ( const unsigned char *  buffer,
const unsigned  buffer_size,
std::map< char, std::string > *  content 
bool ParseKeyvalPath ( const std::string &  filename,
std::map< char, std::string > *  content 
std::string ReplaceAll ( const std::string &  haystack,
const std::string &  needle,
const std::string &  replace_by 
std::vector<std::string> SplitString ( const std::string &  str,
const char  delim,
const unsigned  max_chunks = 0 
int64_t String2Int64 ( const std::string &  value)
uint64_t String2Uint64 ( const std::string &  value)
void String2Uint64Pair ( const std::string &  value,
uint64_t *  a,
uint64_t *  b 
bool String2Uint64Parse ( const std::string &  value,
uint64_t *  result 

Parse a string into a a uint64_t.

Unlike String2Uint64, this:

  • Checks to make sure the full string is parsed
  • Can indicate an error occurred.

If an error occurs, this returns false and sets errno appropriately.

Definition at line 243 of file

Referenced by publish::SyncItem::CheckGraft(), catalog::ClientCatalogManager::IsRevisionBlacklisted(), swissknife::CommandGraft::Main(), main(), Url::Parse(), and Url::ValidateHost().

Here is the caller graph for this function:

std::string StringifyBool ( const bool  value)

This file is part of the CernVM File System.

Definition at line 76 of file

Referenced by manifest::Manifest::ExportString(), swissknife::CommandInfo::Main(), and TalkManager::MainResponder().

Here is the caller graph for this function:

std::string StringifyByteAsHex ( const unsigned char  value)

Definition at line 90 of file

std::string StringifyDouble ( const double  value)
std::string StringifyInt ( const int64_t  value)

Definition at line 78 of file

Referenced by publish::ServerLockFile::Acquire(), anonymous_namespace{}::AppendItemToHeader(), PosixQuotaManager::BindReturnPipe(), swissknife::CommandListCatalogs::CatalogCallback(), swissknife::CommandFileStats::CatalogCallback(), catalog::WritableCatalog::CopyToParent(), PosixQuotaManager::CreateShared(), publish::CmdEnter::CreateUnderlay(), CreateUserNamespace(), cvmfs_options_clone_legacy(), cvmfs_options_init_legacy(), sqlite::Sql::DebugResultTable(), RamCacheManager::Describe(), upload::SessionContext::DoUpload(), anonymous_namespace{}::EnterRootContainer(), swissknife::Error(), manifest::Manifest::ExportString(), AuthzExternalFetcher::Fetch(), MountPoint::FetchHistory(), JsonStringGenerator::JsonEntry::Format(), TalkManager::FormatHostInfo(), TalkManager::FormatProxyInfo(), FuseMain(), swissknife::CommandMigrate::ChownMigrationWorker::GenerateMappingStatement(), Watchdog::GenerateStackTrace(), catalog::TreeCountersBase< FieldT >::GetCsvMap(), LHashMagicXattr::GetValue(), NCleanup24MagicXattr::GetValue(), NClgMagicXattr::GetValue(), RxMagicXattr::GetValue(), SpeedMagicXattr::GetValue(), ExpiresMagicXattr::GetValue(), InodeMaxMagicXattr::GetValue(), MaxFdMagicXattr::GetValue(), PidMagicXattr::GetValue(), UptimeMagicXattr::GetValue(), CachePlugin::HandleHandshake(), AuthzExternalFetcher::Handshake(), swissknife::CommandInfoTag::HumanReadableFilesize(), Init(), PosixQuotaManager::InitDatabase(), anonymous_namespace{}::InitializeHeader(), catalog::ClientCatalogManager::LoadCatalogCas(), FileSystem::LockWorkspace(), CachePlugin::LogSessionError(), CachePlugin::LogSessionInfo(), swissknife::CommandInfo::Main(), publish::CmdEnter::Main(), swissknife::CommandPull::Main(), main(), PosixQuotaManager::MainCacheManager(), Tracer::MainFlush(), swissknife::CommandFileStats::MainProcessing(), TalkManager::MainResponder(), MaintenanceMode(), MakeAcquireRequest(), anonymous_namespace{}::MakeAcquireRequest(), publish::SettingsStorage::MakeGateway(), PosixQuotaManager::MakeReturnPipe(), s3fanout::S3FanoutManager::MkAzureAuthz(), publish::CmdEnter::MountCvmfs(), publish::CmdEnter::MountOverlayfs(), ChunkListMagicXattr::PrepareValueFenced(), perf::Counter::Print(), s3fanout::Statistics::Print(), download::DownloadManager::ProxyInfo::Print(), glue::InodeTracker::Statistics::Print(), swissknife::CommandListTags::PrintHumanReadableTagList(), cvmfs::PrintInodeGeneration(), perf::Counter::PrintK(), perf::Counter::PrintKi(), perf::Counter::PrintM(), catalog::Catalog::PrintMemStatistics(), perf::Counter::PrintMi(), JsonDocument::PrintValue(), swissknife::CommandGraft::Publish(), publish::Publisher(), loader::Reload(), anonymous_namespace{}::RemoveSingle(), anonymous_namespace{}::RemoveUnderlay(), swissknife::CommandMigrate::StatsMigrationWorker::RepairStatisticsCounters(), Watchdog::ReportStacktrace(), RestoreState(), publish::RunSuidHelper(), SaveState(), Watchdog::SendTrace(), FileSystem::SetupCrashGuard(), letter::Letter::Sign(), ExternalCacheManager::SpawnPlugin(), catalog::SqlAllChunks::SqlAllChunks(), Watchdog::Supervise(), notify::msg::Activity::ToJSONString(), manifest::Breadcrumb::ToString(), perf::Counter::ToString(), PosixQuotaManager::UnlinkReturnPipe(), Url::Url(), and AuthzExternalFetcher::~AuthzExternalFetcher().

std::string StringifyTimeval ( const timeval  value)

Definition at line 185 of file

Referenced by Tracer::MainFlush().

Here is the caller graph for this function:

std::string Tail ( const std::string &  source,
unsigned  num_lines 
std::string ToUpper ( const std::string &  mixed_case)
std::string Trim ( const std::string &  raw,
bool  trim_newline = false 
std::string WhitelistTimestamp ( time_t  when)

UTC time in format YYYYMMDDHHMMSS. Used in cvmfs whitelists.

Definition at line 169 of file

Referenced by whitelist::Whitelist::CreateString().

Here is the caller graph for this function: