Support for debug_string method for testing
This commit is contained in:
@@ -22,6 +22,9 @@ using stringvec = std::vector<std::string>;
|
||||
using stringset = std::set<std::string>;
|
||||
using HashValue = std::pair<uint64_t, uint64_t>;
|
||||
|
||||
// Split a string into multiple strings
|
||||
stringvec split(const std::string &s, char sep);
|
||||
|
||||
// String to lowercase/uppercase
|
||||
std::string tolower(std::string input);
|
||||
std::string toupper(std::string input);
|
||||
@@ -32,6 +35,9 @@ bool validinteger(const std::string &value);
|
||||
// String to integer. Returns errval if the number is not parseable.
|
||||
int64_t strtoint(const std::string &value, int64_t errval);
|
||||
|
||||
// String to double. Returns NAN if the number is not parseable.
|
||||
double strtodouble(const std::string &value);
|
||||
|
||||
// Trim strings: left end, right end, both ends.
|
||||
std::string ltrim(std::string s);
|
||||
std::string rtrim(std::string s);
|
||||
@@ -49,6 +55,7 @@ std::string get_file_fingerprint(const std::string &path);
|
||||
// Calculate distance between two points
|
||||
double distance_squared(double x1, double y1, double x2, double y2);
|
||||
|
||||
|
||||
// An XYZ coordinate, general purpose.
|
||||
struct XYZ {
|
||||
float x, y, z;
|
||||
@@ -56,8 +63,9 @@ struct XYZ {
|
||||
XYZ(float ix, float iy, float iz) { x=ix; y=iy; z=iz; }
|
||||
bool operator ==(const XYZ &o) const { return x==o.x && y == o.y && z==o.z; }
|
||||
bool operator !=(const XYZ &o) const { return x!=o.x || y != o.y || z!=o.z; }
|
||||
std::string debug_string() const;
|
||||
};
|
||||
std::ostream & operator << (std::ostream &out, const XYZ &xyz);
|
||||
|
||||
} // namespace util
|
||||
|
||||
#endif // UTIL_HPP
|
||||
|
||||
Reference in New Issue
Block a user