Program Listing for File toml.idl#

Return to documentation for file (interfaces\toml.idl)

 /********************************************************************************
 * Copyright (c) 2025-2026 ZF Friedrichshafen AG
 *
 * This program and the accompanying materials are made available under the
 * terms of the Apache License Version 2.0 which is available at
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Contributors:
 *   Erik Verhoeven - initial API and implementation
 ********************************************************************************/

#include "core.idl"

module sdv
{
    module toml
    {
        exception XTOMLParseException : XSysExcept
        {
            const char _description[] = "TOML parse exception.";

            u8string ssMessage;
        };

        enum ENodeType : uint32
        {
            node_table,
            node_array,
            node_integer,
            node_floating_point,
            node_boolean,
            node_string,
            node_invalid
        };

        const uint32 npos = 0xFFFFFFFF;

        interface INodeInfo
        {
            u8string GetName() const;

            u8string GetPath(in boolean bResolveArrays) const;

            ENodeType GetType() const;

            any GetValue() const;

            uint32 GetIndex() const;

            IInterfaceAccess GetParent() const;

            u8string GetTOML() const;

            enum ECommentType
            {
                comment_before = 0,
                comment_behind = 1,
                out_of_scope_comment_before = 2,
                out_of_scope_comment_behind = 3,
            };

            void SetComment(in ECommentType eType, in u8string ssComment);

            u8string GetComment(in ECommentType eType);

            void AutomaticFormat();

            boolean IsInline() const;

            boolean IsStandard() const;
        };

        interface INodeUpdate
        {
            boolean ChangeName(in u8string ssNewName);

            boolean ChangeValue(in any anyNewValue);

            boolean MoveUp();

            boolean MoveDown();

            boolean DeleteNode();
        };

        interface INodeCollection
        {
            uint32 GetCount() const;

            IInterfaceAccess GetNode(in uint32 uiIndex) const;

            IInterfaceAccess GetNodeDirect(in u8string ssPath) const;
        };

        interface INodeCollectionConvert
        {
            boolean CanMakeInline() const;

            boolean MakeInline();

            boolean CanMakeStandard() const;

            boolean MakeStandard();
        };

        interface INodeCollectionInsert
        {
            IInterfaceAccess InsertValue(in uint32 uiIndex, in u8string ssName, in any anyValue);

            IInterfaceAccess InsertArray(in uint32 uiIndex, in u8string ssName);

            enum EInsertPreference
            {
                prefer_standard = 0,
                prefer_inline = 1,
            };

            IInterfaceAccess InsertTable(in uint32 uiIndex, in u8string ssName, in EInsertPreference ePreference);

            IInterfaceAccess InsertTableArray(in uint32 uiIndex, in u8string ssName, in EInsertPreference ePreference);

            enum EInsertResult : uint32
            {
                insert_fail,
                insert_partly_success,
                insert_success,
            };

            EInsertResult InsertTOML(in uint32 uiIndex, in u8string ssTOML, in boolean bRollbackOnFailure);
        };

        interface ITOMLParser
        {
            boolean Process(in u8string ssContent) raises(XTOMLParseException);
        };
    };
};