1 /*---------------------------------------------------------------------------* 2 3 Copyright (C) Nintendo. All rights reserved. 4 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 11 *---------------------------------------------------------------------------*/ 12 13 #ifndef NN_EC_DATA_SIZE_H_ 14 #define NN_EC_DATA_SIZE_H_ 15 16 #include <nn/ec/ec_Types.h> 17 18 namespace nn { namespace ec { 19 20 //! @addtogroup nn_ec_class 21 //! @{ 22 23 /*! 24 @brief Class for handling a data size. 25 */ 26 class DataSize : public RootObject 27 { 28 public: 29 /*! 30 @brief Specifies the maximum length of the data size string. 31 */ 32 static const size_t STRING_LENGTH_MAX = 6; 33 /*! 34 @brief Specifies the size of the data size string. 35 */ 36 static const size_t STRING_SIZE = STRING_LENGTH_MAX + 1; 37 38 public: 39 /*! 40 @brief Enumerates the units of a data size. 41 42 The Wii U system handles units up to GB. 43 */ 44 enum Unit 45 { 46 UNIT_KB = 1, //!< Kilobytes. 47 UNIT_MB = 2, //!< Megabytes. 48 UNIT_GB = 3, //!< Gigabytes. 49 UNIT_TB = 4, //!< Terabytes. 50 UNIT_PB = 5, //!< Petabytes. 51 UNIT_EB = 6, //!< Exabytes. 52 53 UNIT_MAX, 54 UNIT_FORCE_S32 = 0x7FFFFFFF 55 }; 56 57 public: 58 /*! 59 @brief Instantiates an object. 60 61 @param[in] value Specifies the data size. 62 */ 63 explicit DataSize(u64 value = 0); 64 65 /*! 66 @brief Gets a value. 67 68 Use the value retrieved with this function for size calculations. @n 69 To display the data size, use the string retrieved with <tt>@ref GetString</tt>. 70 71 @return Returns the value. 72 */ 73 u64 GetValue() const; 74 75 /*! 76 @brief Gets the data size as a string. 77 78 The decimal point of the data size string becomes a period if the <tt>@ref DataSize</tt> object was created before <tt>@ref Login</tt>. @n 79 This is because there is no local information before <tt>@ref Login</tt>, so the decimal point is indeterminate. 80 81 @return Returns the data size string. 82 */ 83 const char* GetString() const; 84 85 /*! 86 @brief Gets the unit. 87 88 @return Returns the unit. 89 */ 90 Unit GetUnit() const; 91 92 /*! 93 @brief Gets the unit as a string. 94 95 @return Returns the unit string. 96 */ 97 const char* GetUnitString() const; 98 99 private: 100 // 101 u64 m_value; 102 // 103 u8 m_unit; 104 // 105 char m_string[STRING_SIZE]; 106 }; 107 108 //! @} 109 110 }} // namespace nn::ec 111 112 #endif // NN_EC_DATA_SIZE_H_ 113