Generated reference › API — ICoreSDK/ICoreServices
kind: generated#api#icoresdk-icoreservices

API — ICoreSDK/ICoreServices

The public contract of 4 header(s) under src/ICoreSDK/ICoreServices — 5 class/struct definition(s), 39 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.

ICoreLogger.h#

src/ICoreSDK/ICoreServices/ICoreLogger.h

ICoreLogger#

ICoreLogger.h:9 · class · 7 declaration(s)

class ICoreLogger {
public:
    static long initializeLoggers();

    static void log(const std::string& logText);
    static void logError(const std::string& logText);
    static ICoreLoggerTextBox* createMainLogUI();

    static void logCommandHistory(const std::string &logText);
    static void logCommandHistoryError(const std::string &logText);
    static ICoreLoggerTextBox* createNewCommandHistoryUI();

};
};

ICoreLoggerObject.h#

src/ICoreSDK/ICoreServices/ICoreLoggerObject.h

ICoreLoggerObject -- one log stream: a file, the tail of that file kept in memory, and the set of sinks watching it.

This class is deliberately Qt-free. It used to inherit QObject solely to own a QTimer, and it used to create and feed ICoreLoggerTextBox widgets itself. Both are gone: the flush heartbeat is a std::thread, and views attach themselves through ICoreLogSink. That is what lets the stream run in a console build with no event loop and no widgets, and it keeps the decision about how a line LOOKS on the view's side of the seam.

ICoreLogSink#

ICoreLoggerObject.h:27 · class · 2 declaration(s)

A destination for log lines, implemented by anything that wants to watch a stream (today only ICoreLoggerTextBox).

class ICoreLogSink {
public:
    virtual ~ICoreLogSink() = default;
    virtual void onLogLine(const std::string& line) = 0;
};
};

ICoreLoggerObject#

ICoreLoggerObject.h:34 · class · pImpl · 8 declaration(s)

class ICoreLoggerObject {
public:
    // `fileLoggingEnabled` is consulted at flush time rather than log time, so
    // the preference can change mid-run. It is injected instead of read
    // directly because the preferences header pulls in Qt, which would undo
    // the point of this file. Omitting it means "always write".
    explicit ICoreLoggerObject(const std::string& logFilePath,
                               std::function<bool()> fileLoggingEnabled = {});
    ~ICoreLoggerObject();

    ICoreLoggerObject(const ICoreLoggerObject&) = delete;
    ICoreLoggerObject& operator=(const ICoreLoggerObject&) = delete;

    void log(const std::string& prefix, const std::string& message);
    void logError(const std::string& prefix, const std::string& message);

    // Replays the retained history into `sink` and then registers it, both
    // under the caller's thread, so a line logged in between can neither be
    // missed nor delivered twice.
    void attachSink(ICoreLogSink* sink);
    void detachSink(ICoreLogSink* sink);

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreRunDiagnosis.h#

src/ICoreSDK/ICoreServices/ICoreRunDiagnosis.h

ICoreRunDiagnosis#

ICoreRunDiagnosis.h:7 · class · 6 declaration(s)

class ICoreRunDiagnosis {
public:
    static void log(const std::string& message);
    static void logWarning(const std::string& message);
    static void logError(const double &message);
    static void logError(const std::string& message);

    static void tryCatchingException();
    static bool exceptionCaught();

};
};

ICoreStaticCommands.h#

src/ICoreSDK/ICoreServices/ICoreStaticCommands.h

ICoreStaticCommands#

ICoreStaticCommands.h:13 · class · 16 declaration(s)

Qt-free by design: the helpers that name a Qt GUI type (QFont/QColor serialization, the QGraphicsObject mouse-ungrab) live in ICoreStudio/Registry/ICoreStudioStaticCommands.h, so the block library ...

class ICoreStaticCommands {
public:

    static bool startsWith(const std::string& str, const std::string& prefix);
    static bool endsWith(const std::string& str, const std::string& suffix);
    static bool contains(const std::string& str, const std::string& suffix);

    static std::string removePrefixFromStart(const std::string& str, const std::string& prefix);

    // Helper function to trim leading and trailing '/'
    static std::string trimStartEndSlashes(const std::string& path);

    static std::vector<std::string> splitBySlashes(const std::string& input);

    // ===== Escaped-delimiter (de)serialization =====
    // Serialization formats join fields with a single-char delimiter (e.g. '~'). A free-form
    // field (such as a user-typed description) may itself contain that delimiter, which would
    // otherwise split into the wrong number of fields and corrupt parsing. escapeForDelimiter()
    // backslash-escapes the delimiter (and the backslash itself) on encode; splitEscaped()
    // splits only on UN-escaped delimiters and unescapes each token on decode. Used together
    // they let any field content round-trip safely. The pair is symmetric: a field encoded with
    // escapeForDelimiter(field, d) is recovered exactly by splitEscaped(joined, d).
    static std::string escapeForDelimiter(const std::string& field, char delimiter);
    static std::vector<std::string> splitEscaped(const std::string& input, char delimiter);

    static std::pair<std::string, std::string> splitByLastSlash(const std::string& input);
    static std::string getParentPath(const std::string& path);

    static bool validReturnMessage(const std::string& message);

    // Greatest Common Divisor (GCD)
    static long long gcd_vector(const std::vector<long long>& nums);

    // Least Common Multiple (LCM)
    static long long lcm_two(long long a, long long b);
    static long long lcm_vector(const std::vector<long long>& nums);

    static bool isValidPath(const std::string& str, std::filesystem::path& outPath);

    static bool containsExactlyOnce(const std::string& mainStr,
                                    const std::string& target);

    static bool replaceExactlyOnce(std::string& mainStr,
                                   const std::string& target,
                                   const std::string& replacement);

    static bool replaceAll(std::string& mainStr,
                           const std::string& target,
                           const std::string& replacement);

    static std::string capitalizeFirst(std::string str);

    // static std::string sanitizeIdentifier(const std::string& raw)
    // {
    //     std::string out;
    //     out.reserve(raw.size());
    //
    //     bool lastWasUnderscore = false;
    //     for (const char c : raw) {
    //         const unsigned char uc = static_cast<unsigned char>(c);
    //         if (std::isalnum(uc)) {
    //             out.push_back(c);
    //             lastWasUnderscore = false;
    //         } else {
    //             // Any space / separator / special char -> single underscore,
    //             // collapsing consecutive runs.
    //             if (!lastWasUnderscore) {
    //                 out.push_back('_');
    //                 lastWasUnderscore = true;
    //             }
    //         }
    //     }
    //
    //     // Trim leading/trailing underscores.
    //     const std::size_t b = out.find_first_not_of('_');
    //     if (b == std::string::npos) {
    //         out.clear();
    //     } else {
    //         const std::size_t e = out.find_last_not_of('_');
    //         out = out.substr(b, e - b + 1);
    //     }
    //
    //     // Must not be empty and must not start with a digit.
    //     if (out.empty() || std::isdigit(static_cast<unsigned char>(out.front()))) {
    //         out.insert(out.begin(), '_');
    //     }
    //
    //     return out;
    // }
};
};