-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a63d3c
commit d96010a
Showing
14 changed files
with
131 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,4 @@ struct global_ctx_t{ | |
field_models_t value_models; | ||
}; | ||
|
||
namespace singleton{ | ||
extern vs_test_debug_t debug; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,48 @@ | ||
#pragma once | ||
/** | ||
* @file loader.hpp | ||
* @author karurochari | ||
* @brief Utility function and classes to handle everything related to application loading. | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
|
||
/* | ||
Glue logic exposed to the final application to avoid exposing too many libraries. | ||
*/ | ||
#pragma once | ||
|
||
#include "globals.hpp" | ||
|
||
class ui_tree_xml; | ||
namespace vs{ | ||
struct app_loader{ | ||
ui_tree_xml* root; | ||
|
||
class ui_tree; | ||
|
||
struct loader_t{ | ||
private: | ||
ui_tree* root; | ||
|
||
public: | ||
/** | ||
* @brief Load a new application | ||
* | ||
* @param globals The current global context object. | ||
* @param profile Filename of the profile to use for loading. If `nullptr` default will be used. | ||
* @param path The virtual path to the app root file. | ||
*/ | ||
loader_t(global_ctx_t& globals, const char* profile, const char* path); | ||
|
||
~loader_t(); | ||
|
||
/** | ||
* @brief After building in the constructor, run the application once ready. | ||
* | ||
* @return int 0 if everything went ok, else error codes. | ||
*/ | ||
int run(); | ||
|
||
app_loader(global_ctx_t& globals, const char* profile, const char* path); | ||
~app_loader(); | ||
int run(); | ||
int test(); | ||
/** | ||
* @brief RUn the application in test mode. | ||
* | ||
* @return int if everything went ok, else error codes. | ||
*/ | ||
int test(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @file settings.hpp | ||
* @author karurochari | ||
* @brief Structures to store the instance settings | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
namespace vs{ | ||
|
||
struct settings_t{ | ||
|
||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include <utils/app-env.hpp> | ||
#include <utils/env.hpp> | ||
#include <utils/paths.hpp> | ||
#include <utils/policies.hpp> | ||
#include <cache/memory-storage.hpp> | ||
#include <cache/res-storage.hpp> | ||
#include <cache/kv-storage.hpp> | ||
#include <cache/secrets.hpp> | ||
|
||
namespace vs{ | ||
|
||
namespace singleton{ | ||
|
||
#ifdef VS_USE_NETWORKING_CURL | ||
struct curl_t{ | ||
curl_t(); | ||
~curl_t(); | ||
} extern curl; | ||
#endif | ||
|
||
struct debug_t{ | ||
FILE* fd = nullptr; | ||
debug_t(); | ||
~debug_t(); | ||
|
||
void operator()(const char* field, const char* value); | ||
} extern debug; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,2 @@ | ||
#include <cstdio> | ||
#include <globals.hpp> | ||
#include <cstdlib> | ||
|
||
namespace vs{ | ||
namespace singleton{ | ||
|
||
vs_test_debug_t debug; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <singletons.hpp> | ||
#include <chrono> | ||
|
||
#ifdef VS_USE_NETWORKING_CURL | ||
#include <curl/curl.h> | ||
#endif | ||
|
||
namespace vs{ | ||
namespace singleton{ | ||
|
||
debug_t::debug_t(){auto file=getenv("VS_DEBUG_FILE");if(file!=nullptr)fd=fopen(file,"w+");} | ||
debug_t::~debug_t(){if(fd!=nullptr)fclose(fd);} | ||
|
||
void debug_t::operator()(const char* field, const char* value){ | ||
if(fd==nullptr)return; | ||
else{ | ||
auto now = std::chrono::system_clock::now(); | ||
fprintf(fd,"%s\t%s\t%ld\n",field,value,std::chrono::duration_cast<std::chrono::nanoseconds>(now.time_since_epoch()).count()); | ||
} | ||
} | ||
|
||
|
||
#ifdef VS_USE_NETWORKING_CURL | ||
curl_t::curl_t(){curl_global_init(CURL_GLOBAL_ALL);} | ||
curl_t::~curl_t(){curl_global_cleanup();} | ||
|
||
curl_t curl; | ||
debug_t debug; | ||
#endif | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters