Hyper API for C++ 0.0.18825
Hyper client library for C++ applications
Loading...
Searching...
No Matches
Name.hpp
Go to the documentation of this file.
1
5#ifndef TABLEAU_HYPER_NAME_HPP
6#define TABLEAU_HYPER_NAME_HPP
7
10#include <stdexcept>
11#include <string>
12
13namespace hyperapi {
14
18class Name final {
19 private:
21 std::string name_;
23 std::string unescaped_;
24
25 public:
32 Name(std::string name);
33
38 Name(const char* name);
39
41 const std::string& toString() const { return name_; }
42
44 bool isEmpty() const noexcept { return name_.empty(); }
45
52 const std::string& getUnescaped() const { return unescaped_; }
53};
54
56inline std::ostream& operator<<(std::ostream& os, const Name& name) { return os << name.toString(); }
57
59inline bool operator<(const Name& a, const Name& b) noexcept { return a.getUnescaped() < b.getUnescaped(); }
61inline bool operator==(const Name& a, const Name& b) noexcept { return a.getUnescaped() == b.getUnescaped(); }
63inline bool operator>(const Name& a, const Name& b) noexcept { return b < a; }
65inline bool operator!=(const Name& a, const Name& b) noexcept { return !(a == b); }
67inline bool operator<=(const Name& a, const Name& b) noexcept { return !(a > b); }
69inline bool operator>=(const Name& a, const Name& b) noexcept { return !(a < b); }
70}
71#include <hyperapi/impl/Name.impl.hpp>
72
73#endif
Represents an escaped SQL name.
Definition Name.hpp:18
Name(std::string name)
Constructs a properly quoted and escaped SQL name.
const std::string & toString() const
Definition Name.hpp:41
bool isEmpty() const noexcept
Definition Name.hpp:44
Name(const char *name)
Constructs a properly quoted and escaped SQL name.
const std::string & getUnescaped() const
Definition Name.hpp:52
The primary namespace of the Hyper API for C++.
Definition ByteSpan.hpp:15
bool operator<(const DatabaseName &a, const DatabaseName &b) noexcept
Smaller operator.
bool operator==(const DatabaseName &a, const DatabaseName &b) noexcept
Equality operator.
bool operator>(const DatabaseName &a, const DatabaseName &b) noexcept
Greater operator.
bool operator!=(const DatabaseName &a, const DatabaseName &b) noexcept
Not equal operator.
bool operator>=(const DatabaseName &a, const DatabaseName &b) noexcept
Greater or equal operator.
std::ostream & operator<<(std::ostream &os, const DatabaseName &name)
Stream output operator.
bool operator<=(const DatabaseName &a, const DatabaseName &b) noexcept
Smaller or equal operator.