/** * @file KglString.h * * Copyright (c) 2019 Keyence Corporation. * All rights reserved. * */ #pragma once #include #include namespace Keyence { namespace Impl { class KglStringImpl; } //------------------------------------------------------------ /** * \~English @brief String class. * \~Japanese @brief 文字列クラスです。 */ class KGLLIB_API KglString { public: //------------------------------------------------------------ /** * \~English @brief Default constructor. * \~Japanese @brief デフォルトコンストラクタ。 */ KglString(); //------------------------------------------------------------ /** * \~English @brief Destructor. * \~Japanese @brief デストラクタ。 */ virtual ~KglString(); //------------------------------------------------------------ /** * \~English @brief Copy constructor. * \~Japanese @brief コピーコンストラクタ。 * \~English @param [in] rhs Specifies the KglString object to be used to initialize this KglString. * \~Japanese @param [in] rhs このKglStringを初期化するKglStringオブジェクトを指定します。 */ KglString(const KglString& rhs); //------------------------------------------------------------ /** * \~English @brief Constructor. * \~Japanese @brief コンストラクタ。 * \~English @param [in] pStr Specifies the string to be used to initialize this KglString. * \~Japanese @param [in] pStr このKglStringを初期化する文字列を指定します。 */ KglString(const char* pStr); //------------------------------------------------------------ /** * \~English @brief Retrieves whether the string is a null character. * \~Japanese @brief 空文字か否かを取得します。 * \~English @return True is returned if a character is included. * \~Japanese @return 文字を含んでいる場合はtrueを返します。 */ bool empty() const; //------------------------------------------------------------ /** * \~English @brief Assignment operator. * \~Japanese @brief 代入演算子。 * \~English @param [in] rhs A new string. * \~Japanese @param [in] rhs 新しい文字列。 */ const KglString& operator=(const KglString& rhs); //------------------------------------------------------------ /** * \~English @brief Concatenation operator. * \~Japanese @brief 連結演算子。 * \~English @param [in] rhs The string to be added to the current string. * \~Japanese @param [in] rhs 現在の文字列に追加する文字列。 */ const KglString& operator+=(const KglString& rhs); //------------------------------------------------------------ /** * \~English @brief Equality operator (char*) * \~Japanese @brief 等価演算子(char*) * \~English @param [in] rhs The string to be compared with the current string. * \~Japanese @param [in] rhs 現在の文字列と比較する文字列。 */ bool operator==(const char* rhs) const; //------------------------------------------------------------ /** * \~English @brief Inequality operator (char*) * \~Japanese @brief 不等価演算子(char*) * \~English @param [in] rhs The string to be compared with the current string. * \~Japanese @param [in] rhs 現在の文字列と比較する文字列。 */ bool operator!=(const char* rhs) const; //------------------------------------------------------------ /** * \~English @brief Equality operator * \~Japanese @brief 等価演算子 * \~English @param [in] rhs The string to be compared with the current string. * \~Japanese @param [in] rhs 現在の文字列と比較する文字列。 */ bool operator==(const KglString& rhs) const; //------------------------------------------------------------ /** * \~English @brief Inequality operator * \~Japanese @brief 不等価演算子 * \~English @param [in] rhs The string to be compared with the current string. * \~Japanese @param [in] rhs 現在の文字列と比較する文字列。 */ bool operator!=(const KglString& rhs) const; //------------------------------------------------------------ /** * \~English @brief Comparison operator (less) * \~Japanese @brief 比較演算子(less) * \~English @param [in] rhs The string to be compared with the current string. * \~Japanese @param [in] rhs 現在の文字列と比較する文字列。 */ bool operator<(const KglString& rhs) const; //------------------------------------------------------------ /** * \~English @brief Cast operator * \~Japanese @brief キャスト演算子 * \~English @return Returns the top pointer to the current string. * \~Japanese @return 現在の文字列の先頭ポインタを返します。 */ operator const char*() const; //------------------------------------------------------------ /** * \~English @brief Retrieves the pointer to a string. * \~Japanese @brief 文字列のポインタを取得します。 * \~English @return Returns the top pointer to the current string. * \~Japanese @return 現在の文字列の先頭ポインタを返します。 */ const char* getChar() const; //------------------------------------------------------------ /** * \~English @brief Returns the length of a string. * \~Japanese @brief 文字列の長さを返します。 * \~English @return Length of the string. * \~Japanese @return 文字列の長さ。 */ uint32_t getLength() const; private: Impl::KglStringImpl* _pImpl; }; KGLLIB_API bool operator==(const char* lhs, const KglString& rhs); KGLLIB_API bool operator!=(const char* lhs, const KglString& rhs); }; //end of namespace Keyence