{"id":18395419,"url":"https://github.com/fcf-framework/fcfUnion","last_synced_at":"2025-04-07T03:35:05.630Z","repository":{"id":259398203,"uuid":"877764235","full_name":"fcf-framework/fcfUnion","owner":"fcf-framework","description":"C++11 FCF::Union bidirectional conversion union type (With JSON Support)","archived":false,"fork":false,"pushed_at":"2024-12-08T06:45:49.000Z","size":356,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T00:01:34.575Z","etag":null,"topics":["container","cpp","cpp11","json","parse","stringify","union","variant"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fcf-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-24T07:49:19.000Z","updated_at":"2024-12-08T06:45:52.000Z","dependencies_parsed_at":"2024-10-25T04:20:50.094Z","dependency_job_id":"e8445c5f-566b-4693-b29c-d9e28e7b6c84","html_url":"https://github.com/fcf-framework/fcfUnion","commit_stats":{"total_commits":87,"total_committers":2,"mean_commits":43.5,"dds":0.4022988505747126,"last_synced_commit":"49e62492cb79005b759c515a5928568b1a3b3ae0"},"previous_names":["fcf-framework/union"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcf-framework%2FfcfUnion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcf-framework%2FfcfUnion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcf-framework%2FfcfUnion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcf-framework%2FfcfUnion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcf-framework","download_url":"https://codeload.github.com/fcf-framework/fcfUnion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247589781,"owners_count":20963022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","cpp","cpp11","json","parse","stringify","union","variant"],"created_at":"2024-11-06T02:10:53.630Z","updated_at":"2025-04-07T03:35:05.623Z","avatar_url":"https://github.com/fcf-framework.png","language":"C++","readme":"\n## C++11 FCF::Union bidirectional conversion union type (With JSON Support)\n\n### Content\n\n* [Brief description](#short_description)\n* [Including headers in an executable](#including_headers_executable)\n* [Creating a shared library with the Union class](#creating_shared_library)\n* [Description of types and methods](#description_types_and_methods)\n\t* [Enum fcf::UnionType](#description_union_type)\n\t* [Struct fcf::UnionStringifyOptions](#description_union_stringify_options)\n\t* [Class fcf::Union::iterator](#description_union__iterator)\n\t* [Class fcf::Union::const_iterator](#description_union__const_iterator)\n\t* [Class fcf::Union](#description_union)\n\n\n\n\n\u003ca href=\"https://nowpayments.io/donation?api_key=9E422CC-88M4J1V-H0S6M1Y-TZ7FPYX\" target=\"_blank\"\u003e\n \u003cimg src=\"https://nowpayments.io/images/embeds/donation-button-white.svg\" alt=\"Cryptocurrency \u0026 Bitcoin donation button by NOWPayments\" style=\"    max-width: 100%;\"\u003e\n\u003c/a\u003e\n\n\n\u003ca name=\"short_description\"\u003e\u003c/a\u003e\n### Brief description\n\nThe class provides a simple interface for combining several basic types into a single union.\n\nAn fcf::Union object can store one of the following types:\n- `fcf::Undefined (Numerical equivalent: fcf::UT_UNDEFINED),`\n- `fcf::Null (Numerical equivalent: fcf::UT_NULL),`\n- `int (Numerical equivalent: fcf::UT_INT),`\n- `unsigned int (Numerical equivalent: fcf::UT_UINT),`\n- `long long (Numerical equivalent: fcf::UT_LONGLONG),`\n- `unsigned long long (Numerical equivalent: fcf::UT_ULONGLONG),`\n- `double (Numerical equivalent: fcf::UT_DOUBLE),`\n- `bool (Numerical equivalent: fcf::UT_BOOL),`\n- `std::string (Numerical equivalent: fcf::UT_STRING),`\n- `fcf::UnionVector /*std::vector\u003cfcf::Union\u003e*/ (Numerical equivalent: fcf::UT_VECTOR),`\n- `fcf::UnionMap /*std::map\u003cfcf::Union, fcf::Union, fcf::UnionMapLess\u003e*/ (Numerical equivalent: fcf::UT_MAP),`\n\nThe library is distributed in the form of header files and to start using it, you need to declare the implementation in one cpp file. This is done by including the union.hpp file with the declared `FCF_UNION_IMPLEMENTATION` macro, in other files with the included union.hpp, the `FCF_UNION_IMPLEMENTATION` macro is not needed\n\n```c++\n#define FCF_UNION_IMPLEMENTATION\n\n#include \u003cfcfUnion/union.hpp\u003e\n#include \u003ciostream\u003e\n#include \u003csstream\u003e\n\nint main(int a_argc, const char* a_argv[]){\n\n  //----------------------------\n  // Example of a simple conversion\n  //----------------------------\n  fcf::Union  uDoubleValue(3.14);\n  double      dDoubleValue = (double)uDoubleValue;\n  int         iDoubleValue = (int)uDoubleValue;\n  std::string sDoubleValue = (std::string)uDoubleValue;\n  //\n  // Result\n  // StdOut: Union value: 3.140000; doubel value: 3.14; int value: 3; std::string: 3.140000\n  // \n  std::cout \u003c\u003c \"Union value: \"  \u003c\u003c uDoubleValue\n            \u003c\u003c \"; doubel value: \" \u003c\u003c dDoubleValue\n            \u003c\u003c \"; int value: \" \u003c\u003c iDoubleValue\n            \u003c\u003c \"; std::string: \" \u003c\u003c sDoubleValue \u003c\u003c std::endl;\n\n  //----------------------------\n  // Example of JSON output\n  //----------------------------\n  fcf::Union  uMap(fcf::UT_MAP);\n  uMap[\"key1\"] = \"value1\";\n  uMap[\"key2\"] = fcf::Union(fcf::UT_VECTOR);\n  uMap[\"key2\"].insert(1);\n  uMap[\"key2\"].insert(2);\n  uMap[\"key2\"].insert(3);\n  uMap[\"key3\"] = \"value3\";\n\n  fcf::UnionStringifyOptions so;\n  so.friendly = true;\n  so.tab = \"    \";\n  std::stringstream ss;\n  uMap.stringify(ss, so);\n\n  //\n  // Result\n  // StdOut: JSON for map value:\n  // StdOut: {   \n  // StdOut:     \"key1\": \"value1\",\n  // StdOut:     \"key2\": [1, 2, 3],\n  // StdOut:     \"key3\": \"value3\"\n  // StdOut: }\n  std::cout \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"JSON for map value: \\n\" \u003c\u003c ss.str() \u003c\u003c std::endl;\n\n  //----------------------------\n  // JSON/JSObject parsing example\n  //----------------------------\n  std::stringstream ssource(\n      \"{\\n\"\n      \"  // First value\\n\"\n      \"  1: \\\"value1\\\", \\n\"\n      \"\\n\"\n      \"  /* The second value in the sequence */ \\n\"\n      \"  key9: \\\"value9\\\", \\n\"\n      \"\\n\"\n      \"  \\\"key3\\\": [1,2,3], \\n\"\n      \"}\"\n  );\n  fcf::Union  uJson;\n  uJson.parse(ssource);\n  //\n  // Result\n  // StdOut: The object obtained from JSON is a map: 1\n  // StdOut: The object contains 3 values:\n  // StdOut:   [1]: value1\n  // StdOut:   [key9]: value9\n  // StdOut:   [key3]: [1, 2, 3]\n  // StdOut:\n  // StdOut:   First value from object 'key3': 1\n  // StdOut:   The 'key3' object contains 3 values:\n  // StdOut:      [0]: 1\n  // StdOut:      [1]: 2\n  // StdOut:      [2]: 3\n  std::cout \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"The object obtained from JSON is a map: \" \u003c\u003c uJson.is\u003cfcf::UnionMap\u003e() \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"The object contains \" \u003c\u003c uJson.size() \u003c\u003c \" values:\" \u003c\u003c std::endl;\n  // We use iteration with preservation of the original order (obegin/oend)\n  for(fcf::Union::iterator it = uJson.obegin(); it != uJson.oend(); ++it) {\n    std::cout \u003c\u003c \"  [\" \u003c\u003c it.key() \u003c\u003c \"]: \" \u003c\u003c it.value() \u003c\u003c std::endl;\n  }\n  // Access to vector elements is similar\n  std::cout \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"  First value from object 'key3': \" \u003c\u003c uJson[\"key3\"][0] \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"  The 'key3' object contains \" \u003c\u003c uJson[\"key3\"].size() \u003c\u003c \" values:\" \u003c\u003c std::endl;\n  for(fcf::Union::iterator it = uJson[\"key3\"].begin(); it != uJson[\"key3\"].end(); ++it) {\n    std::cout \u003c\u003c \"        [\" \u003c\u003c it.key() \u003c\u003c \"]: \" \u003c\u003c it.value() \u003c\u003c std::endl;\n  }\n  return 0;\n}\n\n```\n\n\n\u003ca name=\"including_headers_executable\"\u003e\u003c/a\u003e\n### Including headers in an executable\n\nAs mentioned earlier, to include union.hpp it is necessary to declare the implementation (Include the union.hpp file with the declared `FCF_UNION_IMPLEMENTATION` macro). It is best to use a separate file for this, for example unionImpl.cpp. This will allow you to avoid recompiling union.hpp when editing the project. This approach is given as an example below:\n\n**unionImpl.cpp file:**\n```c++\n#define FCF_UNION_IMPLEMENTATION\n#include \u003cfcfUnion/union.hpp\u003e\n```\n\n**main.cpp file:**\n```c++\n#include \u003cfcfUnion/union.hpp\u003e\n#include \u003ciostream\u003e\n#include \u003cfstream\u003e\n\nint main(int a_argc, char* a_argv[]){\n  const char* confFilePath = \"../test/config.json\";\n  std::ifstream ifs;\n  ifs.exceptions(std::ifstream::failbit | std::ifstream::badbit);\n  try {\n    ifs.open(confFilePath);\n    ifs.exceptions(std::ifstream::badbit);\n  } catch(std::exception\u0026 e){\n    std::cout \u003c\u003c \"ERROR: Failed open file '\" \u003c\u003c confFilePath \u003c\u003c \"'.\"  \u003c\u003c std::endl;\n    return 1;\n  }\n  fcf::Union u;\n  u.parse(ifs);\n  \n  // Result\n  // StdOut: The file contains a JSON object: 1\n  // StdOut:   Fields:\n  // StdOut:     [param1]: some value\n  std::cout \u003c\u003c \"The file contains a JSON object: \" \u003c\u003c u.is\u003cfcf::UnionMap\u003e() \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"  Fields: \" \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"    [param1]: \" \u003c\u003c u[\"param1\"] \u003c\u003c std::endl;\n  return 0;\n}\n```\n\n**CMakeLists.txt file**\n```\ncmake_minimum_required(VERSION 3.0)\nproject(example002)\ninclude_directories(SYSTEM ${CMAKE_SOURCE_DIR}/../../../)\nadd_executable(exemple002 unionImpl.cpp main.cpp)\n```\n\n\u003ca name=\"creating_shared_library\"\u003e\u003c/a\u003e\n### Creating a shared library with the Union class\n\nYou can also create a shared DLL/SO that exports the `fcf::Union` class.\n\n1. To do this, the shared library project must declare the macro `FCF_UNION_EXPORT`\n2. The library must declare an implementation of `fcf::Union` (The header union.hpp with the declared macro `FCF_UNION_IMPLEMENTATION` must be included).\n3. In each project in which the library is connected, the macro FCF_UNION_IMPORT must be declared.\n\nBelow is a simple example of exporting and importing the fcf::Union class.\n\n**executable/main.cpp file**\n```c++\n#include \u003cfcfUnion/union.hpp\u003e\n#include \u003ciostream\u003e\n#include \u003cfstream\u003e\n\nint main(int a_argc, char* a_argv[]){\n  std::ifstream ifs(\"config.json\");\n  fcf::Union u;\n  u.parse(ifs);\n\n  std::cout \u003c\u003c \"  The file contains a JSON object: \" \u003c\u003c u.is\u003cfcf::UnionMap\u003e() \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"    Fields: \" \u003c\u003c std::endl;\n  std::cout \u003c\u003c \"      [param1]: \" \u003c\u003c u[\"param1\"] \u003c\u003c std::endl;\n  return 0;\n}\n```\n\n**library/unionImpl.cpp file**\n```c++\n#define FCF_IMPLEMENTATION\n#include \u003cfcfUnion/union.hpp\u003e\n```\n\n**CMakeLists.txt file**\n\nIn the project parameters, we declare the macros `FCF_UNION_IMPORT` and `FCF_UNION_EXPORT`\n\n```\ncmake_minimum_required(VERSION 3.0)\nproject(example003)\ninclude_directories(SYSTEM ${CMAKE_SOURCE_DIR}/../../../)\n\nset(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})\nset(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})\nset(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})\nfile(COPY ../config.json DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})\n\n\nadd_library(\"example003l\" SHARED ./library/unionImpl.cpp)\n# Declare the FCF_UNION_EXPORT macro for the shared library\ntarget_compile_definitions(example003l PRIVATE FCF_UNION_EXPORT)\n\n\nadd_executable(example003 ./executable/main.cpp)\n# Declare the FCF_UNION_IMPORT macro for the executable\ntarget_compile_definitions(example003 PRIVATE FCF_UNION_IMPORT)\ntarget_link_libraries(example003 PRIVATE \"example003l\")\n```\n\n\u003ca name=\"description_types_and_methods\"\u003e\u003c/a\u003e\n### Description of types and methods\n\n\u003ca name=\"description_union_type\"\u003e\u003c/a\u003e\n#### Enum fcf::UnionType\n\nEnum of integer type identifiers stored by the `fcf::Union` class\n\n* `UT_UNDEFINED` - `fcf::Undefined` type\n* `UT_NULL` - `fcf::Null` type\n* `UT_INT` - `int` type\n* `UT_UINT` - `unsigned int` type\n* `UT_LONGLONG` - `long long` type\n* `UT_ULONGLONG` - `unsigned long long` type\n* `UT_DOUBLE` - `double` type\n* `UT_BOOL` - `bool` type\n* `UT_STRING` - `std::string` type\n* `UT_VECTOR` - `fcf::UnionVector` type ( `std::vector\u003cfcf::Union\u003e` )\n* `UT_MAP` - - `fcf::UnionMap` type ( `std::map\u003cfcf::Union, fcf::Union, fcf::UnionMapLess\u003e` ),\n\n\u003ca name=\"description_union_stringify_options\"\u003e\u003c/a\u003e\n#### Struct fcf::UnionStringifyOptions\n\nStructure describing the parameters of translation into string format/JSON\n\n##### Properties\n\n* `bool friendly = false` - If `true`, then output is generated with line breaks and indentation.\n* `const char* tab = \"  \"` - A line containing a tab.\n* `fcf::UnionFormat mode = SF_JSON` - Output format. SF_JSON - Json format. SF_VALUE - the value format is similar to SF_JSON, if the root element is a string, then the value will not be enclosed in quotation marks when output.\n\n\u003ca name=\"description_union__iterator\"\u003e\u003c/a\u003e\n#### Class fcf::Union::iterator\n\nClass of iterator of children of the object [fcf::Union](#description_union)\n\n##### Methods\n\n* `Union key() const` - Child element name/key\n* `Union* operator-\u003e()` - Gets a pointer to the child element\n* `Union\u0026 operator()` - Gets a reference to a child element\n*  `Union\u0026  value()` - Gets a reference to a child element\n* `base_iterator\u0026 operator++()` - increment\n* `bool operator==(const base_iterator\u0026 a_it) const` - comparison\n* `bool operator!=(const base_iterator\u0026 a_it) const` - comparison\n\n\n\u003ca name=\"description_union__const_iterator\"\u003e\u003c/a\u003e\n#### Class fcf::Union::cons_iterator\n\nClass of const iterator of children of the object [fcf::Union](#description_union)\n\n##### Methods\n\n* `Union key() const` - Child element name/key\n* `const Union* operator-\u003e()` - Gets a pointer to the child element\n* `const Union\u0026 operator()` - Gets a reference to a child element\n*  `const Union\u0026  value()` - Gets a reference to a child element\n* `base_iterator\u0026 operator++()` - increment\n* `bool operator==(const base_iterator\u0026 a_it) const` - comparison\n* `bool operator!=(const base_iterator\u0026 a_it) const` - comparison\n\n\n\u003ca name=\"description_union\"\u003e\u003c/a\u003e\n#### Class fcf::Union\n\nThe class object contains a value that has a type - one of the enum [fcf::UnionType](#description_union_type). The class object provides the functionality of bidirectional type conversion and the ability to JSON serialize.\n\n##### Methods\n\n* --- Constructors ---\n* `Union()` - Initializes to `fcf::undefined`\n* `Union(UnionType a_type)` - Initializes a new object with the given type.\n* `template \u003ctypename Ty\u003e Union(const Ty\u0026 a_value)` - Initializes a new object with the given value\n*\n* --- Base methods ---\n* `template \u003ctypename Ty\u003e bool is() const` - Returns `true` if `Ty` type is equal to the type of the stored object value\n* `bool is(fcf::UnionType a_type) const` - Returns `true` if type index `a_type` is equal to the type of the stored object value\n*  `template \u003ctypename Ty\u003e bool isCompatible(bool a_stringifyMode = false) const` - Returns `true` if the stored value can be represented as type `Ty`. If the `a_stringifyMode` argument is `true`, the possibility of converting from string type to type `Ty` is also checked.\n*  `bool isCompatible(fcf::UnionType a_type, bool a_stringifyMode = false) const` - Returns true if the stored value can be represented as type `a_type`. If the `a_stringifyMode` argument is `true`, the possibility of converting from string type to type `a_type` is also checked.\n* `template \u003ctypename Ty\u003e explicit operator Ty() const` - Returns the stored value in the Ty type representation. If the stored value cannot be converted, an `fcf::UnionException` exception is thrown.\n*  `template \u003ctypename Ty\u003e Ty get() const` - Returns the stored value in the Ty type representation. If the stored value cannot be converted, an `fcf::UnionException` exception is thrown.\n*  `template \u003ctypename Ty\u003e fcf::Details::NUnion::TypeHelper\u003cTy\u003e::far_type\u0026 ref()` - Returns a reference to the stored value. If the stored value differs from the requested type, the stored data type is converted to the closest available type and a reference to the stored value is returned. If the conversion process fails, the object is initialized to an empty value.\n*  `template \u003ctypename Ty\u003e void set(const Ty\u0026 a_value)` - Sets a new value.\n*  `void set(const fcf::Union\u0026 a_value)` - Sets a new value.\n*  `template \u003ctypename Ty\u003e void set()` - Sets a new empty value with the given type\n*  `void set(fcf::UnionType a_type)` - Sets a new empty value with the given type\n*  `template \u003ctypename Ty\u003e fcf::Union\u0026 operator=(const Ty\u0026 a_value)` - Sets a new value.\n*  `fcf::Union\u0026 operator=(const fcf::Union\u0026 a_union)` - Sets a new value.\n*  `template \u003ctypename Ty\u003e bool equal(const Ty\u0026 a_value, bool a_strict, bool a_deep) const` - Returns `true` if the stored value is equal to `a_value`. If `a_strict` is `true`, then a strict comparison is performed (types must match). If the `a_deep` parameter is `true`, then an element-wise comparison is performed for `fcf::UnionVector` and `fcf::UnionMap`.\n* `template \u003ctypename Ty\u003e bool operator==(const Ty\u0026 a_value) const` - Performs a non-strict and non-deep equality comparison. Returns `true` if the stored value is equal to `a_value`.\n* `template \u003ctypename Ty\u003e bool operator!=(const Ty\u0026 a_value) const` - Performs a non-strict and non-deep non-equality comparison. Returns `true` if the stored value is not equal to `a_value`.\n*\n* --- Serialization methods ---\n*  `void stringify(std::string\u0026 a_dest, const fcf::UnionStringifyOptions\u0026 a_options = fcf::UnionStringifyOptions{}) const` - Saves the stored data to the variable `a_dest` in JSON format\n*  `void stringify(std::basic_ostream\u003cchar\u003e\u0026 a_dest, const UnionStringifyOptions\u0026 a_options = UnionStringifyOptions{}) const` - Saves the stored data to the `a_dest` stream in JSON format\n*  `void parse(const std::string\u0026 a_source)` - Parses a JSON string. The original format may have deviations from JSON (like JS): may contain comments; may contain a comma after the last element; object keys do not have to be enclosed in quotes.\n*  `void parse(std::basic_istream\u003cchar\u003e\u0026 a_source)` - Parses a JSON stream. The original format may have deviations from JSON (like JS): may contain comments; may contain a comma after the last element; object keys do not have to be enclosed in quotes.\n*  \n* --- Accessing child elements ---\n* `size_t size() const` - Returns the number of child elements\n* `fcf::Union::iterator find(fcf::Union a_key)` - Searches for a child element by key. Returns an iterator to the found element. If the element is not found, returns an iterator to the end (`Union::end()`)\n* `fcf::Union\u0026 at(fcf::Union a_key)` - Returns a reference to a child element by key. If the child element is not found, then for `fcf::UnionVector` and `fcf::UnionMap` an element is created, and for other types an `fcf::UnionException` is thrown.\n* `const fcf::Union\u0026 cat(fcf::Union a_key) const` - Returns a const reference to a child element by key. If the child element is not found, an `fcf::UnionException` is thrown.\n* `fcf::Union\u0026 operator[](fcf::Union a_key)` - Returns a reference to a child element by key. If the child element is not found, then for `fcf::UnionVector` and `fcf::UnionMap` an element is created, and for other types an `fcf::UnionException` is thrown. \n* `fcf::Union::iterator insert(fcf::Union a_value)` - Inserts a new child element into the object and returns a iterator to it. The key of the new element will be equal to its ordinal in the object - the `size()` value before incrementing. If the object is not a container (`fcf::UT_VECTOR` | `fcf::UT_MAP`), then `fcf::UnionException` is thrown.\n* `fcf::Union::iterator insert(fcf::Union a_key, fcf::Union a_value)` - Inserts a new child element into the object and returns a iterator to it. If the object is not a container (`fcf::UT_VECTOR` | `fcf::UT_MAP`), then `fcf::UnionException` is thrown.\n* `fcf::Union::iterator erase(const fcf::Union\u0026 a_key)` - Removes an element by key. Returns an iterator to the next element. If the element is not found, the function returns `end()`\n* `fcf::Union::iterator erase(const fcf::Union::iterator\u0026 a_iterator)` - Removes an element. Returns an iterator to the next element. If the element is not found, the function returns `end()`.\n*\n* --- Iterators ---\n* `fcf::Union::iterator begin()` - Returns an [iterator](#description_union__iterator) to the first child element\n* `fcf::Union::iterator end()` - Returns an [iterator](#description_union__iterator) to end\n* `fcf::Union::const_iterator cbegin() const` - Returns an [const iterator](#description_union__const_iterator) to the first child element\n* `fcf::Union::const_iterator cend() const` - Returns an [const iterator](#description_union__const_iterator) to end\n* `fcf::Union::iterator obegin()` - Returns an [iterator](#description_union__iterator) to the first child element, preserving sequence. If the `fcf::Union` object is an `fcf::UnionMap`, then the elements are iterated in the order they were added. For other types the method is similar to `begin()`.\n* `fcf::Union::iterator oend()` - Returns an [iterator](#description_union__iterator) to end\n* `fcf::Union::const_iterator cobegin() const` - Returns an [const iterator](#description_union__const_iterator) to the first child element, preserving sequence. If the `fcf::Union` object is an `fcf::UnionMap`, then the elements are iterated in the order they were added. For other types the method is similar to `cbegin()`.\n* `fcf::Union::const_iterator coend() const` - Returns an [const iterator](#description_union__const_iterator) to end\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcf-framework%2FfcfUnion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcf-framework%2FfcfUnion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcf-framework%2FfcfUnion/lists"}