<commit_before>//******************************************************************
//
// Copyright 2015 Samsung Electronics All Rights Reserved.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

/**
 * @file
 *
 * This file contains the declaration of classes and its members related to RCSResourceAttributes
 */
#ifndef RES_ENCAPSULATION_RESOURCEATTRIBUTES_H
#define RES_ENCAPSULATION_RESOURCEATTRIBUTES_H

// To avoid conflict using different boost::variant configuration with OC.
// It causes compile errors.
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_LIST_SIZE 30
#define BOOST_MPL_LIMIT_VECTOR_SIZE 30

#include <functional>
#include <unordered_map>
#include <vector>

#include "boost/variant.hpp"
#include "boost/mpl/contains.hpp"
#include "boost/mpl/find.hpp"
#include "boost/mpl/distance.hpp"
#include "boost/mpl/begin_end.hpp"
#include "boost/scoped_ptr.hpp"

#include "RCSException.h"

namespace OIC
{
    namespace Service
    {
        /**
        * This RCSByteString the one of RCSResourceAttributes value for Byte String (Binary).
        *
        * It provides similar usage to c++ standard vector.<br/>
        * An RCSByteString can be one of various attribute value type.
        *
        * @see Value
        * @see Type
        * @see RCSRemoteResourceObject
        * @see RCSResourceObject
        * @see RCSResourceAttributes
        */
        class RCSByteString
        {
        public:
            typedef std::vector<uint8_t> DataType;

            /**
             * Returns a vector<uint8_t> type of byte string.
             *
             * @return A stored byte string with std::vector<uint8_t>
             */
            DataType getByteString() const
            {
                return {m_data};
            }

            /**
             * Returns a size of stored vector<uint8_t>.
             *
             * @return A size of stored byte string.
             */
            size_t size() const
            {
                return m_data.size();
            }

            /**
              * @relates RCSByteString
              *
              * Checks if the byte string is same contents, or not.
              *
              * @return true if the byte string are equal, false otherwise.
              */
            inline bool operator==(const RCSByteString& rhs) const
            {
                return this->m_data == rhs.getByteString();
            }

            /**
             * @relates RCSByteString
             *
             * Checks if the byte string is not same contents, or is same.
             *
             * @return true if the byte string are not equal, false otherwise.
             */
            inline bool operator!=(const RCSByteString& rhs) const
            {
                return this->m_data != rhs.getByteString();
            }

            /**
             * Return a value of indexed byte string.
             *
             * @param it location of the element.
             *
             * @return A copied value of indexed byte string.
             */
            inline uint8_t operator[](size_t it) const
            {
                return this->m_data[it];
            }

            RCSByteString()
            {
            }
            RCSByteString(DataType && rhs)
            : m_data {std::move(rhs)}
            {
            }
            RCSByteString(const DataType & rhs)
            : m_data {rhs}
            {
            }
            RCSByteString(RCSByteString && rhs)
            : m_data {DataType{rhs.getByteString()}}
            {
            }
            RCSByteString(const RCSByteString & rhs)
            : m_data {DataType{rhs.getByteString()}}
            {
            }

            RCSByteString(::OCByteString && rhs)
            : m_data {DataType{rhs.bytes, rhs.bytes + rhs.len}}
            {
            }
            RCSByteString(const ::OCByteString & rhs)
            : m_data {DataType{rhs.bytes, rhs.bytes + rhs.len}}
            {
            }

            RCSByteString(uint8_t* bytes, size_t size)
            : m_data {DataType{bytes, bytes + size}}
            {
            }
            inline RCSByteString& operator=(RCSByteString&& rhs)
            {
                return operator =(rhs);
            }
            inline RCSByteString& operator=(const RCSByteString& rhs)
            {
                if (!m_data.empty())
                {
                    m_data.clear();
                }
                m_data = DataType{rhs.getByteString()};
                return *this;
            }<commit_msg>Minor static analysis bug fix.<commit_after>//******************************************************************
//
// Copyright 2015 Samsung Electronics All Rights Reserved.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

/**
 * @file
 *
 * This file contains the declaration of classes and its members related to RCSResourceAttributes
 */
#ifndef RES_ENCAPSULATION_RESOURCEATTRIBUTES_H
#define RES_ENCAPSULATION_RESOURCEATTRIBUTES_H

// To avoid conflict using different boost::variant configuration with OC.
// It causes compile errors.
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_LIST_SIZE 30
#define BOOST_MPL_LIMIT_VECTOR_SIZE 30

#include <functional>
#include <unordered_map>
#include <vector>

#include "boost/variant.hpp"
#include "boost/mpl/contains.hpp"
#include "boost/mpl/find.hpp"
#include "boost/mpl/distance.hpp"
#include "boost/mpl/begin_end.hpp"
#include "boost/scoped_ptr.hpp"

#include "RCSException.h"

namespace OIC
{
    namespace Service
    {
        /**
        * This RCSByteString the one of RCSResourceAttributes value for Byte String (Binary).
        *
        * It provides similar usage to c++ standard vector.<br/>
        * An RCSByteString can be one of various attribute value type.
        *
        * @see Value
        * @see Type
        * @see RCSRemoteResourceObject
        * @see RCSResourceObject
        * @see RCSResourceAttributes
        */
        class RCSByteString
        {
        public:
            typedef std::vector<uint8_t> DataType;

            /**
             * Returns a vector<uint8_t> type of byte string.
             *
             * @return A stored byte string with std::vector<uint8_t>
             */
            DataType getByteString() const
            {
                return {m_data};
            }

            /**
             * Returns a size of stored vector<uint8_t>.
             *
             * @return A size of stored byte string.
             */
            size_t size() const
            {
                return m_data.size();
            }

            /**
              * @relates RCSByteString
              *
              * Checks if the byte string is same contents, or not.
              *
              * @return true if the byte string are equal, false otherwise.
              */
            inline bool operator==(const RCSByteString& rhs) const
            {
                return this->m_data == rhs.getByteString();
            }

            /**
             * @relates RCSByteString
             *
             * Checks if the byte string is not same contents, or is same.
             *
             * @return true if the byte string are not equal, false otherwise.
             */
            inline bool operator!=(const RCSByteString& rhs) const
            {
                return this->m_data != rhs.getByteString();
            }

            /**
             * Return a value of indexed byte string.
             *
             * @param it location of the element.
             *
             * @return A copied value of indexed byte string.
             */
            inline uint8_t operator[](size_t it) const
            {
                return this->m_data[it];
            }

            RCSByteString()
            {
            }
            RCSByteString(DataType && rhs)
            : m_data {std::move(rhs)}
            {
            }
            RCSByteString(const DataType & rhs)
            : m_data {rhs}
            {
            }
            RCSByteString(RCSByteString && rhs)
            : m_data {DataType{rhs.getByteString()}}
            {
            }
            RCSByteString(const RCSByteString & rhs)
            : m_data {DataType{rhs.getByteString()}}
            {
            }

            RCSByteString(::OCByteString && rhs)
            : m_data {DataType{rhs.bytes, rhs.bytes + rhs.len}}
            {
            }
            RCSByteString(const ::OCByteString & rhs)
            : m_data {DataType{rhs.bytes, rhs.bytes + rhs.len}}
            {
            }

            RCSByteString(uint8_t* bytes, size_t size)
            : m_data {DataType{bytes, bytes + size}}
            {
            }
            inline RCSByteString& operator=(RCSByteString&& rhs)
            {
                return operator =(rhs);
            }
            inline RCSByteString& operator=(const RCSByteString& rhs)
            {
                if(&rhs != this)
                {
                    if (!m_data.empty())
                    {
                        m_data.clear();
                    }
                    m_data = DataType{rhs.getByteString()};
                }
                return *this;
            }
{'fraction_non_alphanumeric': 0.12150943396226416, 'fraction_numerical': 0.0033962264150943396, 'mean_word_length': 1.5079252424887628, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '4331865', 'n_tokens_mistral': 2871, 'n_tokens_neox': 2745, 'n_words': 772}