Use `std::`-prefix for a few more occurrences in standard types for consistency
This commit is contained in:
parent
1748fe674c
commit
213dfb823d
|
@ -54,7 +54,7 @@ int main(int argc, char **)
|
||||||
cout << data.get<string_view>() << endl;
|
cout << data.get<string_view>() << endl;
|
||||||
|
|
||||||
struct Bert {
|
struct Bert {
|
||||||
uint16_t x, y;
|
std::uint16_t x, y;
|
||||||
};
|
};
|
||||||
auto b = data.get_struct<Bert>();
|
auto b = data.get_struct<Bert>();
|
||||||
cout << b.x << " " << b.y << endl;
|
cout << b.x << " " << b.y << endl;
|
||||||
|
@ -64,7 +64,7 @@ int main(int argc, char **)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
size_t size = 1ULL * 4096 * 244140ULL;
|
std::size_t size = 1ULL * 4096 * 244140ULL;
|
||||||
for (unsigned int n = 0;; ++n) {
|
for (unsigned int n = 0;; ++n) {
|
||||||
if (!(n % 16384)) {
|
if (!(n % 16384)) {
|
||||||
size += 16384;
|
size += 16384;
|
||||||
|
|
|
@ -11,18 +11,18 @@ using namespace std;
|
||||||
using namespace LMDBSafe;
|
using namespace LMDBSafe;
|
||||||
|
|
||||||
struct DNSResourceRecord {
|
struct DNSResourceRecord {
|
||||||
string qname; // index
|
std::string qname; // index
|
||||||
uint16_t qtype{ 0 };
|
std::uint16_t qtype{ 0 };
|
||||||
uint32_t domain_id{ 0 }; // index
|
std::uint32_t domain_id{ 0 }; // index
|
||||||
string content;
|
std::string content;
|
||||||
uint32_t ttl{ 0 };
|
std::uint32_t ttl{ 0 };
|
||||||
string ordername; // index
|
std::string ordername; // index
|
||||||
bool auth{ true };
|
bool auth{ true };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DomainInfo {
|
struct DomainInfo {
|
||||||
string qname;
|
std::string qname;
|
||||||
string master;
|
std::string master;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Archive> void serialize(Archive &ar, DomainInfo &g, const unsigned int version)
|
template <class Archive> void serialize(Archive &ar, DomainInfo &g, const unsigned int version)
|
||||||
|
@ -47,7 +47,7 @@ struct compound {
|
||||||
std::string operator()(const DNSResourceRecord &rr)
|
std::string operator()(const DNSResourceRecord &rr)
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
uint32_t id = htonl(rr.domain_id);
|
std::uint32_t id = htonl(rr.domain_id);
|
||||||
ret.assign(reinterpret_cast<char *>(&id), 4);
|
ret.assign(reinterpret_cast<char *>(&id), 4);
|
||||||
ret.append(rr.ordername);
|
ret.append(rr.ordername);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -56,8 +56,8 @@ struct compound {
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
TypedDBI<DNSResourceRecord, index_on<DNSResourceRecord, string, &DNSResourceRecord::qname>,
|
TypedDBI<DNSResourceRecord, index_on<DNSResourceRecord, std::string, &DNSResourceRecord::qname>,
|
||||||
index_on<DNSResourceRecord, uint32_t, &DNSResourceRecord::domain_id>, index_on_function<DNSResourceRecord, string, compound>>
|
index_on<DNSResourceRecord, std::uint32_t, &DNSResourceRecord::domain_id>, index_on_function<DNSResourceRecord, std::string, compound>>
|
||||||
tdbi(getMDBEnv("./typed.lmdb", MDB_NOSUBDIR, 0600), "records");
|
tdbi(getMDBEnv("./typed.lmdb", MDB_NOSUBDIR, 0600), "records");
|
||||||
|
|
||||||
TypedDBI<DomainInfo, index_on<DomainInfo, string, &DomainInfo::qname>> tdomains(tdbi.getEnv(), "domains");
|
TypedDBI<DomainInfo, index_on<DomainInfo, string, &DomainInfo::qname>> tdomains(tdbi.getEnv(), "domains");
|
||||||
|
|
|
@ -12,12 +12,12 @@ void countDB(MDBEnv &env, MDBROTransaction &txn, const std::string &dbname)
|
||||||
CPP_UTILITIES_UNUSED(env)
|
CPP_UTILITIES_UNUSED(env)
|
||||||
auto db = txn->openDB(dbname, 0);
|
auto db = txn->openDB(dbname, 0);
|
||||||
auto cursor = txn->getCursor(db);
|
auto cursor = txn->getCursor(db);
|
||||||
uint32_t count = 0;
|
std::uint32_t count = 0;
|
||||||
MDBOutVal key, val;
|
MDBOutVal key, val;
|
||||||
while (!cursor.get(key, val, count ? MDB_NEXT : MDB_FIRST)) {
|
while (!cursor.get(key, val, count ? MDB_NEXT : MDB_FIRST)) {
|
||||||
cout << key.get<string>();
|
cout << key.get<std::string>();
|
||||||
if (key.d_mdbval.mv_size == 4)
|
if (key.d_mdbval.mv_size == 4)
|
||||||
cout << " " << key.get<uint32_t>();
|
cout << " " << key.get<std::uint32_t>();
|
||||||
cout << ": " << val.get<std::string>();
|
cout << ": " << val.get<std::string>();
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
++count;
|
++count;
|
||||||
|
|
Loading…
Reference in New Issue