parse struct and union sequences

This commit is contained in:
Jan
2021-02-18 21:55:13 +01:00
parent 57547854c4
commit fb55cdb468
24 changed files with 316 additions and 19 deletions

View File

@ -0,0 +1,17 @@
#include "NameUtils.h"
#include <random>
#include <sstream>
std::string NameUtils::GenerateRandomName()
{
static constexpr auto ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::ostringstream str;
std::random_device random;
for (auto i = 0u; i < 32u; i++)
str << ALPHABET[random() % std::char_traits<char>::length(ALPHABET)];
return str.str();
}

View File

@ -0,0 +1,9 @@
#pragma once
#include <string>
class NameUtils
{
public:
static std::string GenerateRandomName();
};

View File

@ -13,6 +13,11 @@ std::string NamespaceBuilder::Combine(const std::string& _namespace, const std::
return str.str();
}
bool NamespaceBuilder::IsEmpty() const
{
return m_elements.empty();
}
void NamespaceBuilder::Push(std::string element)
{
m_elements.emplace_back(std::move(element));

View File

@ -10,6 +10,7 @@ class NamespaceBuilder
public:
static std::string Combine(const std::string& _namespace, const std::string& name);
_NODISCARD bool IsEmpty() const;
void Push(std::string element);
void Pop();
std::string ToString();