Do bulk replace of stl types.

This commit is contained in:
jmsgrogan 2023-12-21 09:18:44 +00:00
parent 521486be62
commit c25a56ee19
531 changed files with 2274 additions and 2181 deletions

View file

@ -7,10 +7,10 @@
TEST_CASE(TestLexer_MatchPattern, "[compiler]")
{
std::string input = "[I'm inside the tag](I'm inside the brackets), followed by more text.";
std::string pattern = "[@](@)";
String input = "[I'm inside the tag](I'm inside the brackets), followed by more text.";
String pattern = "[@](@)";
std::vector<std::string> hits;
Vector<String> hits;
const auto matched = Lexer::matchPattern(pattern, input, '@', hits);
REQUIRE(matched);
REQUIRE(hits.size() == 2);

View file

@ -9,8 +9,8 @@ TEST_CASE(TestHuffmanCodeLengthTable, "compression")
{
HuffmanCodeLengthTable table;
std::vector<std::pair<unsigned, unsigned char> > mappings {{144, 8}, {112, 9}, {24, 7}, {8 ,8}};
std::vector<unsigned char> code_length_sequence;
Vector<std::pair<unsigned, unsigned char> > mappings {{144, 8}, {112, 9}, {24, 7}, {8 ,8}};
Vector<unsigned char> code_length_sequence;
for(const auto& entry : mappings)
{
for(unsigned idx=0;idx<entry.first;idx++)
@ -37,7 +37,7 @@ TEST_CASE(TestHuffmanCodeLengthTable, "compression")
TEST_CASE(TestLiteralsTable, "compression")
{
std::vector<unsigned char> lengths = {7,4,4,7,5,5,7,7,6,6,7,6,6,6,8,6,6,8,
Vector<unsigned char> lengths = {7,4,4,7,5,5,7,7,6,6,7,6,6,6,8,6,6,8,
6,6,7,6,8,7,7,7,7,7,7,6,6,7,7,6,6,7,7,8,8,7,7,7,6,6,7,7,7,7,6,7,7,7,
7,7,7,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -65,7 +65,7 @@ TEST_CASE(TestLiteralsTable, "compression")
}
HuffmanCodeLengthTable codingTable;
std::vector<unsigned char> coding_lengths{4, 0, 6, 7, 3, 2, 4, 2, 7, 4, 6, 3, 0, 6, 0, 0, 0, 0, 0};
Vector<unsigned char> coding_lengths{4, 0, 6, 7, 3, 2, 4, 2, 7, 4, 6, 3, 0, 6, 0, 0, 0, 0, 0};
codingTable.setInputLengthSequence(coding_lengths, true);
codingTable.buildPrefixCodes();
@ -78,7 +78,7 @@ TEST_CASE(TestLiteralsTable, "compression")
out_stream.writeNBits(10, 4);
/*
std::vector<unsigned char> permuted(19, 0);
Vector<unsigned char> permuted(19, 0);
static constexpr unsigned DEFLATE_PERMUTATION[19]{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
unsigned count = 0;
for (auto length : coding_lengths)

View file

@ -8,9 +8,9 @@
TEST_CASE(TestLz77Encoder, "compression")
{
std::vector<unsigned> values {0, 10, 11, 12, 10, 11, 12, 0, 13, 14, 15, 10, 11, 12};
Vector<unsigned> values {0, 10, 11, 12, 10, 11, 12, 0, 13, 14, 15, 10, 11, 12};
//std::vector<unsigned> values {0, 1, 2, 3, 0, 1, 2, 3, 0,1};
//Vector<unsigned> values {0, 1, 2, 3, 0, 1, 2, 3, 0,1};
BufferBitStream input_stream;
for (auto value : values)

View file

@ -11,7 +11,7 @@
TEST_CASE(TestRunLengthEncoder, "compression")
{
std::string test_data = "BCAAAADDDCCACACAC";
String test_data = "BCAAAADDDCCACACAC";
RunLengthEncoder encoder;
auto encoded = encoder.encode(StringUtils::toBytes(test_data));
@ -25,8 +25,8 @@ TEST_CASE(TestRunLengthEncoder, "compression")
TEST_CASE(TestHuffmanEncoder, "compression")
{
//std::string testData = "BCAADDDCCACACAC";
//std::vector<unsigned char> stream(testData.begin(), testData.end());
//String testData = "BCAADDDCCACACAC";
//Vector<unsigned char> stream(testData.begin(), testData.end());
std::unordered_map<unsigned char, unsigned> counts;
counts['A'] = 1;
@ -44,8 +44,8 @@ TEST_CASE(TestHuffmanEncoder, "compression")
TEST_CASE(TestLz77Encoder, "compression")
{
std::string test_data = "sir sid eastman easily teases sea sick seals";
//std::string test_data = "sir sid eastman";
String test_data = "sir sid eastman easily teases sea sick seals";
//String test_data = "sir sid eastman";
BufferBitStream input_stream;
input_stream.setBuffer(StringUtils::toBytes(test_data));

View file

@ -29,13 +29,13 @@ TEST_CASE(TestConsoleApp, "console")
if (isatty(ttyfd))
{
auto tty_name = ttyname(ttyfd);
std::string tty_name_str;
String tty_name_str;
if (tty_name != nullptr)
{
tty_name_str = std::string(tty_name);
tty_name_str = String(tty_name);
}
std::string fd_msg = "Hello tty: '" + tty_name_str + "'\n";
String fd_msg = "Hello tty: '" + tty_name_str + "'\n";
//write(ttyfd, fd_msg.data(), fd_msg.size());
TermInfo term_info;
@ -78,9 +78,9 @@ TEST_CASE(TestConsoleApp, "console")
std::cout << "timeout" << std::endl;
break;
}
std::vector<char> buffer(100);
Vector<char> buffer(100);
auto read_size = read(ttyfd, buffer.data(), buffer.size());
std::string out(buffer.begin(), buffer.begin()+read_size);
String out(buffer.begin(), buffer.begin()+read_size);
std::cout << "buf: " << out << std::endl;
}
std::cout << "loop break" << std::endl;

View file

@ -7,7 +7,7 @@
TEST_CASE(TestReadBitStream, "core")
{
std::vector<std::string> bytes{
Vector<String> bytes{
"11101101",
"01011101",
"00001001",

View file

@ -70,21 +70,21 @@ TEST_CASE(String_Slice, "core")
/*
TEST_CASE(TestStringUtils_StripSurroundingWhitepsace, "core")
{
std::string input = " super() ";
std::string stripped = StringUtils::stripSurroundingWhitepsace(input);
String input = " super() ";
String stripped = StringUtils::stripSurroundingWhitepsace(input);
REQUIRE(stripped == "super()");
}
TEST_CASE(TestStringUtils_RemoveUpTo, "core")
{
std::string input = "def{filename}abc/123/456";
std::string removed = StringUtils::removeUpTo(input, "{filename}");
String input = "def{filename}abc/123/456";
String removed = StringUtils::removeUpTo(input, "{filename}");
REQUIRE(removed == "abc/123/456");
}
TEST_CASE(TestStringUtils_startsWith, "core")
{
std::string input = " ```some triple ticks ";
String input = " ```some triple ticks ";
bool ignore_whitespace{false};
auto starts_with = StringUtils::startsWith(input, "```", ignore_whitespace);
REQUIRE(!starts_with);

View file

@ -14,12 +14,12 @@ public:
VAR_CHAR255
};
using Entry = std::pair<std::string, Type>;
using Entry = std::pair<String, Type>;
std::string mName;
std::vector<Entry> mColumns;
String mName;
Vector<Entry> mColumns;
std::string toString(Type type) const
String toString(Type type) const
{
switch (type)
{
@ -32,9 +32,9 @@ public:
}
}
std::string getCreateQuery() const
String getCreateQuery() const
{
std::string query = "CREATE TABLE " + mName + " ( ";
String query = "CREATE TABLE " + mName + " ( ";
std::size_t count = 0;
for (const auto& column : mColumns)
{
@ -67,7 +67,7 @@ TEST_CASE(TestDatabaseManager, "database")
{"City", DbTable::Type::VAR_CHAR255}
};
std::string statement = table.getCreateQuery();
String statement = table.getCreateQuery();
db_manager.run(statement);
db_manager.onShutDown();

View file

@ -8,14 +8,14 @@
#include "PathNode.h"
#include "PolygonNode.h"
void addRect(const Point2& loc, std::vector<std::unique_ptr<MaterialNode> >& nodes, double radius = 0.0)
void addRect(const Point2& loc, Vector<Ptr<MaterialNode> >& nodes, double radius = 0.0)
{
auto node = std::make_unique<RectangleNode>(Transform(loc), 150.0, 100.0);
node->setRadius(radius);
nodes.push_back(std::move(node));
}
void addCircle(const Point2& loc, std::vector<std::unique_ptr<MaterialNode> >& nodes, double minorRadius = 0.0)
void addCircle(const Point2& loc, Vector<Ptr<MaterialNode> >& nodes, double minorRadius = 0.0)
{
const auto radius = 50.0;
auto centre_loc = loc;
@ -31,20 +31,20 @@ void addCircle(const Point2& loc, std::vector<std::unique_ptr<MaterialNode> >& n
nodes.push_back(std::move(node));
}
void addLine(const Point2& loc, std::vector<std::unique_ptr<MaterialNode> >& nodes)
void addLine(const Point2& loc, Vector<Ptr<MaterialNode> >& nodes)
{
std::vector<Point2> points = { Point2(150.0, 100.0) };
Vector<Point2> points = { Point2(150.0, 100.0) };
auto node = std::make_unique<LineNode>(Transform(loc), points);
nodes.push_back(std::move(node));
}
void addPath(const Point2& loc, const std::string& path, std::vector<std::unique_ptr<MaterialNode> >& nodes)
void addPath(const Point2& loc, const String& path, Vector<Ptr<MaterialNode> >& nodes)
{
auto node = std::make_unique<PathNode>(Transform(loc), path);
nodes.push_back(std::move(node));
}
void addPolygon(const Point2& loc, std::vector<std::unique_ptr<MaterialNode> >& nodes)
void addPolygon(const Point2& loc, Vector<Ptr<MaterialNode> >& nodes)
{
auto p0 = Point2{ 0.0, 0.0 };
auto p1 = Point2{ 150.0, 0.0 };
@ -55,7 +55,7 @@ void addPolygon(const Point2& loc, std::vector<std::unique_ptr<MaterialNode> >&
nodes.push_back(std::move(node));
}
void addShapes(const Point2& start_loc, std::vector<std::unique_ptr<MaterialNode> >& nodes, bool use_fill = false)
void addShapes(const Point2& start_loc, Vector<Ptr<MaterialNode> >& nodes, bool use_fill = false)
{
auto loc = start_loc;
@ -103,7 +103,7 @@ TEST_CASE(TestD2dOffScreenRendering_Outlines, "graphics")
{
TestRenderer renderer(800, 800);
std::vector<std::unique_ptr<MaterialNode> > nodes;
Vector<Ptr<MaterialNode> > nodes;
auto loc = Point2(10, 10);
@ -123,7 +123,7 @@ TEST_CASE(TestD2dOffScreenRendering_Fill, "graphics")
{
TestRenderer renderer(800, 800);
std::vector<std::unique_ptr<MaterialNode> > nodes;
Vector<Ptr<MaterialNode> > nodes;
auto loc = Point2(10, 10);

View file

@ -9,8 +9,8 @@
#include "Button.h"
#include "TransformNode.h"
#include <memory>
#include <string>
#include "Memory.h"
#include "String.h"
#include <iostream>
TEST_CASE(TestD2dRendering, "graphics")

View file

@ -12,8 +12,8 @@
#include "Scene.h"
#include "Widget.h"
#include <memory>
#include <string>
#include "Memory.h"
#include "String.h"
#include <iostream>
TEST_CASE(TestDirectXRendering, "graphics")

View file

@ -6,8 +6,8 @@
#include "TestFramework.h"
#include <memory>
#include <string>
#include "Memory.h"
#include "String.h"
#include <iostream>
TEST_CASE(TestOpenGlRendering, "graphics")

View file

@ -20,7 +20,7 @@ TEST_CASE(TestUncompressedPng, "image")
image->setNumChannels(numChannels);
image->setBitDepth(8);
std::vector<unsigned char> data(width*height, 0);
Vector<unsigned char> data(width*height, 0);
for (unsigned idx=0; idx<width*height; idx++)
{
unsigned char val = 255 * idx /(width*height);
@ -53,7 +53,7 @@ TEST_CASE(TestFixedPng, "image")
image->setNumChannels(numChannels);
image->setBitDepth(8);
std::vector<unsigned char> data(width*height, 0);
Vector<unsigned char> data(width*height, 0);
for (unsigned idx=0; idx<width*height; idx++)
{
//unsigned char val = 100 * idx /(width*height);
@ -77,7 +77,7 @@ TEST_CASE(TestDynamicCompressedPng, "image")
image->setNumChannels(numChannels);
image->setBitDepth(8);
std::vector<unsigned char> data(width*height, 0);
Vector<unsigned char> data(width*height, 0);
for (unsigned idx=0; idx<width*height; idx++)
{
//unsigned char val = 100 * idx /(width*height);

View file

@ -18,7 +18,7 @@ TEST_CASE(TestPlotting, "[publishing]")
PlotSeries series("Series-1");
std::vector<Point2> data{ {0.0, 0.0}, {10.0, 40.0}, {20.0, 80.0} };
Vector<Point2> data{ {0.0, 0.0}, {10.0, 40.0}, {20.0, 80.0} };
series.setData(data);
plot->addSeries(series);

View file

@ -64,8 +64,8 @@ public:
}
private:
std::unique_ptr<DrawingSurface> mSurface;
std::unique_ptr<DrawingContext> mDrawingContext;
Ptr<DrawingSurface> mSurface;
Ptr<DrawingContext> mDrawingContext;
std::unique_ptr<FontsManager> mFontsManager;
Ptr<FontsManager> mFontsManager;
};

View file

@ -3,7 +3,7 @@
#include "MainApplication.h"
#include "DesktopManager.h"
TestUiApplication::TestUiApplication(std::unique_ptr<CommandLineArgs> args, std::unique_ptr<MainApplication> mainApp)
TestUiApplication::TestUiApplication(Ptr<CommandLineArgs> args, Ptr<MainApplication> mainApp)
: GuiApplication(std::move(args), std::move(mainApp))
{

View file

@ -3,12 +3,12 @@
#include "GuiApplication.h"
#include "Scene.h"
#include <memory>
#include "Memory.h"
class TestUiApplication : public GuiApplication
{
public:
TestUiApplication(std::unique_ptr<CommandLineArgs> args = nullptr, std::unique_ptr<MainApplication> mainApp = nullptr);
TestUiApplication(Ptr<CommandLineArgs> args = nullptr, Ptr<MainApplication> mainApp = nullptr);
DesktopManager* getDesktopManager() const;

View file

@ -9,7 +9,7 @@ using Path = std::filesystem::path;
class TestUtils
{
public:
static Path getTestOutputDir(const std::string& testFileName = {})
static Path getTestOutputDir(const String& testFileName = {})
{
if (!testFileName.empty())
{

View file

@ -21,7 +21,7 @@ TEST_CASE(TestMarkdownParser, "[web]")
MarkdownParser parser;
auto md_doc = parser.run(md_content);
std::vector<MarkdownElement::Type> expected_top_level = {
Vector<MarkdownElement::Type> expected_top_level = {
MarkdownElement::Type::HEADING,
MarkdownElement::Type::PARAGRAPH,
MarkdownElement::Type::HEADING,
@ -58,7 +58,7 @@ TEST_CASE(TestMarkdownParser_Simple, "[web]")
MarkdownParser parser;
auto md_doc = parser.run(md_content);
std::vector<MarkdownElement::Type> expected_top_level = {
Vector<MarkdownElement::Type> expected_top_level = {
MarkdownElement::Type::PARAGRAPH,
MarkdownElement::Type::BULLET_LIST};

View file

@ -18,7 +18,7 @@ TEST_CASE(TestXmlParser, "web")
xml_file.open(TestUtils::getTestDataDir() / "test.xml", std::ifstream::in);
while(xml_file.good())
{
std::string line;
String line;
std::getline(xml_file, line);
parser.processLine(line);
}