Tidy up some xml structures.
This commit is contained in:
parent
875cdc84ff
commit
8771b721d1
31 changed files with 885 additions and 563 deletions
|
@ -5,7 +5,7 @@ target_include_directories(sample_gui PUBLIC
|
|||
"${PROJECT_SOURCE_DIR}/src/client"
|
||||
)
|
||||
target_link_libraries(sample_gui PUBLIC client windows console core
|
||||
network database geometry audio graphics)
|
||||
network database geometry audio graphics web)
|
||||
|
||||
# Sample Console
|
||||
add_executable(sample_console console-main.cpp)
|
||||
|
@ -13,7 +13,7 @@ target_include_directories(sample_console PUBLIC
|
|||
"${PROJECT_SOURCE_DIR}/src/console"
|
||||
)
|
||||
target_link_libraries(sample_console PUBLIC console core network
|
||||
database geometry audio)
|
||||
database geometry audio web)
|
||||
|
||||
# Xml practice
|
||||
add_executable(xml_practice xml-practice.cpp)
|
||||
|
@ -21,12 +21,4 @@ target_include_directories(xml_practice PUBLIC
|
|||
"${PROJECT_SOURCE_DIR}/src/core"
|
||||
"${PROJECT_SOURCE_DIR}/src/web/xml"
|
||||
)
|
||||
target_link_libraries(xml_practice PUBLIC core web)
|
||||
|
||||
# Markdown practice
|
||||
add_executable(markdown_practice markdown-practice.cpp)
|
||||
target_include_directories(markdown_practice PUBLIC
|
||||
"${PROJECT_SOURCE_DIR}/src/core"
|
||||
"${PROJECT_SOURCE_DIR}/src/web/markdown"
|
||||
)
|
||||
target_link_libraries(markdown_practice PUBLIC web core)
|
||||
target_link_libraries(xml_practice PUBLIC core web)
|
|
@ -1,37 +1,18 @@
|
|||
#include <filesystem>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include "CommandLineArgs.h"
|
||||
#include "MainApplication.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CommandLineArgs command_line_args;
|
||||
command_line_args.Process(argc, argv);
|
||||
auto command_line_args = CommandLineArgs::CreateUnique();
|
||||
command_line_args->Process(argc, argv);
|
||||
command_line_args->RecordLaunchPath();
|
||||
|
||||
std::string program_type;
|
||||
if(command_line_args.GetNumberOfArgs() > 1)
|
||||
{
|
||||
program_type = command_line_args.GetArg(1);
|
||||
}
|
||||
// Start the main app
|
||||
auto main_app = MainApplication::Create();
|
||||
main_app->Initialize(std::move(command_line_args));
|
||||
|
||||
// Start the main app
|
||||
auto main_app = MainApplication::Create();
|
||||
main_app->Initialize(std::filesystem::current_path());
|
||||
main_app->Run();
|
||||
|
||||
if(program_type == "server")
|
||||
{
|
||||
main_app->RunServer();
|
||||
}
|
||||
else if(program_type == "audio")
|
||||
{
|
||||
main_app->PlayAudio();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Unknown program type" << std::endl;
|
||||
}
|
||||
|
||||
main_app->ShutDown();
|
||||
return 0;
|
||||
main_app->ShutDown();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
#include <filesystem>
|
||||
#include <memory>
|
||||
|
||||
#include "GuiApplication.h"
|
||||
#include "MainApplication.h"
|
||||
#include "CommandLineArgs.h"
|
||||
|
||||
int main()
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
auto command_line_args = CommandLineArgs::CreateUnique();
|
||||
command_line_args->Process(argc, argv);
|
||||
command_line_args->RecordLaunchPath();
|
||||
|
||||
// Start the main app
|
||||
auto main_app = MainApplication::Create();
|
||||
main_app->Initialize(std::filesystem::current_path());
|
||||
main_app->Initialize(std::move(command_line_args));
|
||||
|
||||
// Start the gui app
|
||||
auto gui_app = std::make_shared<GuiApplication>();
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <ostream>
|
||||
#include "CommandLineArgs.h"
|
||||
#include "MarkdownParser.h"
|
||||
#include "HtmlDocument.h"
|
||||
#include "HtmlWriter.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CommandLineArgs command_line_args;
|
||||
command_line_args.Process(argc, argv);
|
||||
|
||||
if(command_line_args.GetNumberOfArgs() < 2)
|
||||
{
|
||||
std::cerr << "Expected a filepath argument" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
MarkdownParser parser;
|
||||
const auto filepath = command_line_args.GetArg(1);
|
||||
|
||||
if(!std::filesystem::exists(filepath))
|
||||
{
|
||||
std::cerr << "Couldn't find file: " << filepath << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::ifstream md_file;
|
||||
md_file.open(filepath, std::ifstream::in);
|
||||
while(md_file.good())
|
||||
{
|
||||
std::string line;
|
||||
std::getline(md_file, line);
|
||||
parser.ProcessLine(line);
|
||||
}
|
||||
md_file.close();
|
||||
|
||||
auto html_document = parser.GetHtml();
|
||||
HtmlWriter writer;
|
||||
std::string html_string = writer.ToString(html_document);
|
||||
std::ofstream out("/home/james/test.html");
|
||||
out << html_string;
|
||||
out.close();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue