OpenCPN Partial API docs
Loading...
Searching...
No Matches
ocpn_utils.h File Reference

Miscellaneous utilities, many of which string related. More...

#include <string>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  ocpn
 Standard, mostly strings utilities.
 

Functions

bool ocpn::endswith (const std::string &s, const std::string &suffix)
 Return true if s ends with given suffix.
 
bool ocpn::startswith (const std::string &s, const std::string &prefix)
 Return true if s starts with given prefix.
 
std::string ocpn::ltrim (const std::string &s)
 Strip possibly leading space characters in s.
 
std::string ocpn::rtrim (const std::string &s)
 Strip possibly trailing space characters in s.
 
std::string ocpn::trim (std::string s)
 Strip possibly trailing and/or leading space characters in s.
 
std::string ocpn::join (std::vector< std::string > v, char c)
 Return a single string being the concatenation of all elements in v with character c in between.
 
std::string ocpn::tolower (const std::string &s)
 Return copy of s with all characters converted to lower case.
 
std::vector< std::string > ocpn::split (const char *s, const std::string &delimiter)
 Return vector of items in s separated by delimiter.
 
std::vector< std::string > ocpn::split (const std::string &s, const std::string &delimiter)
 Return vector of items in s separated by delimiter.
 
bool ocpn::exists (const std::string &name)
 
void ocpn::mkdir (const std::string path)
 
bool ocpn::replace (std::string &str, const std::string &from, const std::string &to)
 Perform in place substitution in str, replacing "from" with "to".
 
void ocpn::copy_file (const std::string &src_path, const std::string &dest_path)
 Copy file contents in path src_path to dest_path.
 
bool ocpn::N0183CheckSumOk (const std::string &sentence)
 Check if checksum in a NMEA0183 sentence is correct.
 
std::string ocpn::printable (const std::string &str)
 Return copy of str with non-printable chars replaced by hex like "<0D>".
 

Detailed Description

Miscellaneous utilities, many of which string related.

Definition in file ocpn_utils.h.