<commit_before>/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * This file is part of the libone project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef INCLUDED_LIBONE_GUID_H
#define INCLUDED_LIBONE_GUID_H

#include <string>
#include <cstdint>
#include <array>
#include <librevenge-stream/librevenge-stream.h>

namespace libone
{

class GUID
{
public:
  GUID();
  GUID(const uint32_t data1, const uint16_t data2, const uint16_t data3,
       const std::array<uint16_t,4> data4);
  GUID(const uint32_t data1, const uint16_t data2, const uint16_t data3,
       const uint16_t data4_1, const uint16_t data4_2,
       const uint16_t data4_3, const uint16_t data4_4);

  void parse(librevenge::RVNGInputStream *input);

  std::string to_string() const;
  void from_string(const std::string str);

  bool is_equal(const GUID other) const;


  void zero();

  friend librevenge::RVNGInputStream *operator>>(librevenge::RVNGInputStream *input, GUID &obj);

  friend bool operator==(const GUID &lhs, const GUID &rhs) noexcept;
  friend bool operator!=(const GUID &lhs, const GUID &rhs) noexcept;


  uint32_t data1() const;
  uint16_t data2() const;
  uint16_t data3() const;
  std::array<uint16_t,4> data4() const;

private:
  uint32_t Data1 = 0;
  uint16_t Data2 = 0;
  uint16_t Data3 = 0;
  std::array<uint16_t, 4> Data4 {{ 0, 0, 0, 0 }};
};

}

#endif<commit_msg>Add doxygen info<commit_after>/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * This file is part of the libone project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef INCLUDED_LIBONE_GUID_H
#define INCLUDED_LIBONE_GUID_H

#include <string>
#include <cstdint>
#include <array>
#include <librevenge-stream/librevenge-stream.h>

namespace libone
{

/** @brief globally unique identifier class specified by [RFC4122] or [C706] */
class GUID
{
public:
  /** Default construtor. Initializes to {00000000-0000-0000-0000-000000000000}. */
  GUID();

  /** Constructor to initialize specific GUID */
  GUID(const uint32_t data1, const uint16_t data2, const uint16_t data3,
       const std::array<uint16_t,4> data4);

  /** Constructor to initialize specific GUID */
  GUID(const uint32_t data1, const uint16_t data2, const uint16_t data3,
       const uint16_t data4_1, const uint16_t data4_2,
       const uint16_t data4_3, const uint16_t data4_4);

  /** Parse GUID's content from RVNGInputStream byte stream. */
  void parse(librevenge::RVNGInputStream *input);

  /** Converts GUID object to a string in this format: "{00000000-0000-0000-0000-000000000000}" */
  std::string to_string() const;

  /** Parse GUID object from string.
   * @param str - should have the format "{00000000-0000-0000-0000-000000000000}" */
  void from_string(const std::string str);

  /** Checks if GUIDs are identical */
  bool is_equal(const GUID other) const;


  /** resets GUID to {00000000-0000-0000-0000-000000000000} */
  void zero();

  friend librevenge::RVNGInputStream *operator>>(librevenge::RVNGInputStream *input, GUID &obj);

  friend bool operator==(const GUID &lhs, const GUID &rhs) noexcept;
  friend bool operator!=(const GUID &lhs, const GUID &rhs) noexcept;


  /** Getter.
   * @return first data sequence GUID */
  uint32_t data1() const;
  /** Getter.
   * @ return second data sequence of GUID */
  uint16_t data2() const;
  /** Getter.
   * @ return third data sequence of GUID */
  uint16_t data3() const;
  /** Getter.
   * @ return forth data sequence of GUID */
  std::array<uint16_t,4> data4() const;

private:
  uint32_t Data1 = 0;
  uint16_t Data2 = 0;
  uint16_t Data3 = 0;
  std::array<uint16_t, 4> Data4 {{ 0, 0, 0, 0 }};
};

}

#endif
{'fraction_non_alphanumeric': 0.122636815920398, 'fraction_numerical': 0.07189054726368159, 'mean_word_length': 3.885783718104496, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6836565', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1421, 'n_words': 437}