Upstream tarball 10013
[amule.git] / src / libs / ec / cpp / ECTag.cpp
blob6d3ea5d49d9dcec6542c9fd91945c5490f77e865
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2004-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 //
6 // Any parts of this program derived from the xMule, lMule or eMule project,
7 // or contributed by third-party developers are copyrighted by their
8 // respective authors.
9 //
10 // This program is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 2 of the License, or
13 // (at your option) any later version.
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #ifdef __DEBUG__
26 #define DEBUG_EC_IMPLEMENTATION
28 #include <common/Format.h> // Needed for CFormat
29 #endif
31 #include "ECTag.h" // Needed for ECTag
32 #include "ECSocket.h" // Needed for CECSocket
33 #include "ECSpecialTags.h" // Needed for CValueMap
35 /**********************************************************
36 * *
37 * CECTag class *
38 * *
39 **********************************************************/
41 //! Defines the Null tag which may be returned by GetTagByNameSafe.
42 const CECTag CECTag::s_theNullTag;
44 /**
45 * Creates a new null-valued CECTag instance
47 * @see s_theNullTag
48 * @see GetTagByNameSafe
50 CECTag::CECTag() :
51 m_tagName(0),
52 m_dataType(EC_TAGTYPE_UNKNOWN),
53 m_dataLen(0),
54 m_tagData(NULL) // All access functions check m_dataType, so no need to allocate a dummy buffer.
58 /**
59 * Creates a new CECTag instance from the given data
61 * @param name TAG name
62 * @param length length of data buffer
63 * @param data TAG data
66 CECTag::CECTag(ec_tagname_t name, unsigned int length, const void *data) : m_tagName(name)
68 m_dataLen = length;
69 if (data) {
70 NewData();
71 memcpy(m_tagData, data, m_dataLen);
72 } else {
73 m_tagData = NULL;
75 m_dataType = EC_TAGTYPE_CUSTOM;
78 /**
79 * Creates a new CECTag instance for custom data
81 * @param name TAG name
82 * @param length length of data buffer that will be alloc'ed
83 * @param dataptr pointer to a void pointer which will be assigned the internal TAG data buffer
85 * \note TAG data buffer has to be filled with valid data after the ctor
87 CECTag::CECTag(ec_tagname_t name, unsigned int length, void **dataptr) : m_tagName(name)
89 m_dataLen = length;
90 NewData();
91 *dataptr = m_tagData;
92 m_dataType = EC_TAGTYPE_CUSTOM;
95 /**
96 * Creates a new CECTag instance, which contains an IPv4 address.
98 * This function takes care of the endianness of the port number.
100 * @param name TAG name
101 * @param data The EC_IPv4_t class containing the IPv4 address.
103 * @see GetIPv4Data()
105 CECTag::CECTag(ec_tagname_t name, const EC_IPv4_t& data) : m_tagName(name)
108 m_dataLen = sizeof(EC_IPv4_t);
109 NewData();
110 RawPokeUInt32( ((EC_IPv4_t *)m_tagData)->m_ip, RawPeekUInt32( data.m_ip ) );
111 ((EC_IPv4_t *)m_tagData)->m_port = ENDIAN_HTONS(data.m_port);
112 m_dataType = EC_TAGTYPE_IPV4;
116 * Creates a new CECTag instance, which contains a MD4 hash.
118 * This function takes care to store hash in network byte order.
120 * @param name TAG name
121 * @param data The CMD4Hash class containing the MD4 hash.
123 * @see GetMD4Data()
125 CECTag::CECTag(ec_tagname_t name, const CMD4Hash& data) : m_tagName(name)
127 m_dataLen = 16;
128 NewData();
129 RawPokeUInt64( m_tagData, RawPeekUInt64( data.GetHash() ) );
130 RawPokeUInt64( m_tagData + 8, RawPeekUInt64( data.GetHash() + 8 ) );
131 m_dataType = EC_TAGTYPE_HASH16;
135 * Creates a new CECTag instance, which contains a string
137 * @param name TAG name
138 * @param data wxString object, it's contents are converted to UTF-8.
140 * @see GetStringDataSTL()
142 CECTag::CECTag(ec_tagname_t name, const std::string& data) : m_tagName(name)
144 ConstructStringTag(name, data);
148 * Creates a new CECTag instance, which contains a string
150 * @param name TAG name
151 * @param data wxString object, it's contents are converted to UTF-8.
153 * @see GetStringData()
155 CECTag::CECTag(ec_tagname_t name, const wxString& data)
157 ConstructStringTag(name, (const char*)unicode2UTF8(data));
159 CECTag::CECTag(ec_tagname_t name, const wxChar* data)
161 ConstructStringTag(name, (const char*)unicode2UTF8(data));
165 * Copy constructor
167 CECTag::CECTag(const CECTag& tag)
169 m_tagData = NULL;
170 *this = tag;
174 * Creates a new CECTag instance, which contains an int value.
176 * This takes care of endianness problems with numbers.
178 * @param name TAG name.
179 * @param data number.
181 * @see GetInt()
183 CECTag::CECTag(ec_tagname_t name, bool data) : m_tagName(name)
185 InitInt(data);
187 CECTag::CECTag(ec_tagname_t name, uint8 data) : m_tagName(name)
189 InitInt(data);
191 CECTag::CECTag(ec_tagname_t name, uint16 data) : m_tagName(name)
193 InitInt(data);
195 CECTag::CECTag(ec_tagname_t name, uint32 data) : m_tagName(name)
197 InitInt(data);
199 CECTag::CECTag(ec_tagname_t name, uint64 data) : m_tagName(name)
201 InitInt(data);
204 void CECTag::InitInt(uint64 data)
206 if (data <= 0xFF) {
207 m_dataType = EC_TAGTYPE_UINT8;
208 m_dataLen = 1;
209 } else if (data <= 0xFFFF) {
210 m_dataType = EC_TAGTYPE_UINT16;
211 m_dataLen = 2;
212 } else if (data <= 0xFFFFFFFF) {
213 m_dataType = EC_TAGTYPE_UINT32;
214 m_dataLen = 4;
215 } else {
216 m_dataType = EC_TAGTYPE_UINT64;
217 m_dataLen = 8;
220 NewData();
222 switch (m_dataType) {
223 case EC_TAGTYPE_UINT8:
224 PokeUInt8( m_tagData, (uint8) data );
225 break;
226 case EC_TAGTYPE_UINT16:
227 PokeUInt16( m_tagData, wxUINT16_SWAP_ALWAYS((uint16) data ));
228 break;
229 case EC_TAGTYPE_UINT32:
230 PokeUInt32( m_tagData, wxUINT32_SWAP_ALWAYS((uint32) data ));
231 break;
232 case EC_TAGTYPE_UINT64:
233 PokeUInt64( m_tagData, wxUINT64_SWAP_ALWAYS(data) );
234 break;
239 * Creates a new CECTag instance, which contains a double precision floating point number
241 * @param name TAG name
242 * @param data double number
244 * @note The actual data is converted to string representation, because we have not found
245 * yet an effective and safe way to transmit floating point numbers.
247 * @see GetDoubleData()
249 CECTag::CECTag(ec_tagname_t name, double data) : m_tagName(name)
251 std::ostringstream double_str;
252 double_str << data;
253 std::string double_string = double_str.str();
254 const char * double_chr = double_string.c_str();
255 m_dataLen = (ec_taglen_t)strlen(double_chr) + 1;
256 NewData();
257 memcpy(m_tagData, double_chr, m_dataLen);
258 m_dataType = EC_TAGTYPE_DOUBLE;
262 * Destructor - frees allocated data and deletes child TAGs.
264 CECTag::~CECTag(void)
266 delete [] m_tagData;
270 * Copy assignment operator.
272 * std::vector uses this, but the compiler-supplied version wouldn't properly
273 * handle m_dynamic and m_tagData. This wouldn't be necessary if m_tagData
274 * was a smart pointer (Hi, Kry!).
276 CECTag& CECTag::operator=(const CECTag& tag)
278 if (&tag != this) {
279 m_tagName = tag.m_tagName;
280 m_dataLen = tag.m_dataLen;
281 m_dataType = tag.m_dataType;
282 delete [] m_tagData;
283 if (m_dataLen != 0) {
284 NewData();
285 memcpy(m_tagData, tag.m_tagData, m_dataLen);
286 } else {
287 m_tagData = NULL;
289 m_tagList.clear();
290 if (!tag.m_tagList.empty()) {
291 m_tagList.reserve(tag.m_tagList.size());
292 for (TagList::size_type i=0; i<tag.m_tagList.size(); i++) {
293 m_tagList.push_back(tag.m_tagList[i]);
298 return *this;
302 * Compare operator.
305 bool CECTag::operator==(const CECTag& tag) const
307 return m_dataType == tag.m_dataType
308 && m_tagName == tag.m_tagName
309 && m_dataLen == tag.m_dataLen
310 && (m_dataLen == 0
311 || !memcmp(m_tagData, tag.m_tagData, m_dataLen))
312 && m_tagList == tag.m_tagList;
316 * Add a child tag to this one.
318 * Be very careful that this creates a copy of \e tag. Thus, the following code won't work as expected:
319 * \code
321 * CECPacket *p = new CECPacket(whatever);
322 * CECTag *t1 = new CECTag(whatever);
323 * CECTag *t2 = new CECTag(whatever);
324 * p.AddTag(*t1);
325 * t1.AddTag(*t2); // t2 won't be part of p !!!
327 * \endcode
329 * To get the desired results, the above should be replaced with something like:
331 * \code
333 * CECPacket *p = new CECPacket(whatever);
334 * CECTag *t1 = new CECTag(whatever);
335 * CECTag *t2 = new CECTag(whatever);
336 * t1.AddTag(*t2);
337 * delete t2; // we can safely delete t2 here, because t1 holds a copy
338 * p.AddTag(*t1);
339 * delete t1; // now p holds a copy of both t1 and t2
341 * \endcode
343 * Then why copying? The answer is to enable simplifying the code like this:
345 * \code
347 * CECPacket *p = new CECPacket(whatever);
348 * CECTag t1(whatever);
349 * t1.AddTag(CECTag(whatever)); // t2 is now created on-the-fly
350 * p.AddTag(t1); // now p holds a copy of both t1 and t2
352 * \endcode
354 * @param tag a CECTag class instance to add.
355 * @return \b true if tag was really added,
356 * \b false when it was omitted through valuemap.
358 bool CECTag::AddTag(const CECTag& tag, CValueMap* valuemap)
360 if (valuemap) {
361 return valuemap->AddTag(tag, this);
363 // cannot have more than 64k tags
364 wxASSERT(m_tagList.size() < 0xffff);
366 m_tagList.push_back(tag);
367 return true;
370 void CECTag::AddTag(ec_tagname_t name, uint64_t data, CValueMap* valuemap)
372 if (valuemap) {
373 valuemap->CreateTag(name, data, this);
374 } else {
375 AddTag(CECTag(name, data));
379 void CECTag::AddTag(ec_tagname_t name, const wxString& data, CValueMap* valuemap)
381 if (valuemap) {
382 valuemap->CreateTag(name, data, this);
383 } else {
384 AddTag(CECTag(name, data));
388 void CECTag::AddTag(ec_tagname_t name, const CMD4Hash& data, CValueMap* valuemap)
390 if (valuemap) {
391 valuemap->CreateTag(name, data, this);
392 } else {
393 AddTag(CECTag(name, data));
397 bool CECTag::ReadFromSocket(CECSocket& socket)
399 ec_tagname_t tmp_tagName;
400 if (!socket.ReadNumber(&tmp_tagName, sizeof(ec_tagname_t))) {
401 return false;
403 m_tagName = tmp_tagName >> 1;
404 bool hasChildren = (tmp_tagName & 0x01) != 0;
406 if (!socket.ReadNumber(&m_dataType, sizeof(ec_tagtype_t))) {
407 return false;
410 if (!socket.ReadNumber(&m_dataLen, sizeof(ec_taglen_t))) {
411 return false;
414 if (hasChildren && !ReadChildren(socket)) {
415 return false;
418 unsigned int tmp_len = m_dataLen;
419 m_dataLen = 0;
420 m_dataLen = tmp_len - GetTagLen();
421 if (m_dataLen > 0) {
422 NewData();
423 if (!socket.ReadBuffer(m_tagData, m_dataLen)) {
424 return false;
426 } else {
427 m_tagData = NULL;
430 return true;
434 bool CECTag::WriteTag(CECSocket& socket) const
436 ec_tagname_t tmp_tagName = (m_tagName << 1) | (m_tagList.empty() ? 0 : 1);
437 ec_tagtype_t type = m_dataType;
438 ec_taglen_t tagLen = GetTagLen();
439 wxASSERT(type != EC_TAGTYPE_UNKNOWN);
441 if (!socket.WriteNumber(&tmp_tagName, sizeof(ec_tagname_t))) return false;
442 if (!socket.WriteNumber(&type, sizeof(ec_tagtype_t))) return false;
443 if (!socket.WriteNumber(&tagLen, sizeof(ec_taglen_t))) return false;
445 if (!m_tagList.empty()) {
446 if (!WriteChildren(socket)) return false;
449 if (m_dataLen > 0) {
450 if (m_tagData != NULL) { // This is here only to make sure everything, it should not be NULL at this point
451 if (!socket.WriteBuffer(m_tagData, m_dataLen)) return false;
455 return true;
458 bool CECTag::ReadChildren(CECSocket& socket)
460 uint16 tmp_tagCount;
461 if (!socket.ReadNumber(&tmp_tagCount, sizeof(uint16))) {
462 return false;
464 m_tagList.clear();
465 if (tmp_tagCount > 0) {
466 m_tagList.reserve(tmp_tagCount);
467 for (int i=0; i<tmp_tagCount; i++) {
468 m_tagList.push_back(CECTag());
469 CECTag& tag = m_tagList[i];
470 if (!tag.ReadFromSocket(socket)) {
471 return false;
475 return true;
478 bool CECTag::WriteChildren(CECSocket& socket) const
480 wxASSERT(m_tagList.size() < 0xFFFF);
481 uint16 tmp = (uint16)m_tagList.size();
482 if (!socket.WriteNumber(&tmp, sizeof(tmp))) return false;
483 if (!m_tagList.empty()) {
484 for (TagList::size_type i=0; i<m_tagList.size(); i++) {
485 if (!m_tagList[i].WriteTag(socket)) return false;
488 return true;
492 * Finds the (first) child tag with given name.
494 * @param name TAG name to look for.
495 * @return the tag found, or NULL.
497 const CECTag* CECTag::GetTagByName(ec_tagname_t name) const
499 for (TagList::size_type i=0; i<m_tagList.size(); i++)
500 if (m_tagList[i].m_tagName == name) return &m_tagList[i];
501 return NULL;
505 * Finds the (first) child tag with given name.
507 * @param name TAG name to look for.
508 * @return the tag found, or NULL.
510 CECTag* CECTag::GetTagByName(ec_tagname_t name)
512 for (TagList::size_type i=0; i<m_tagList.size(); i++)
513 if (m_tagList[i].m_tagName == name) return &m_tagList[i];
514 return NULL;
518 * Finds the (first) child tag with given name.
520 * @param name TAG name to look for.
521 * @return the tag found, or a special null-valued tag otherwise.
523 * @see s_theNullTag
525 const CECTag* CECTag::GetTagByNameSafe(ec_tagname_t name) const
527 const CECTag* result = GetTagByName(name);
528 if (result == NULL)
529 result = &s_theNullTag;
530 return result;
534 * Query TAG length that is suitable for the TAGLEN field (i.e.\
535 * without it's own header size).
537 * @return Tag length, containing its childs' length.
539 uint32 CECTag::GetTagLen(void) const
541 uint32 length = m_dataLen;
542 for (TagList::size_type i=0; i<m_tagList.size(); i++) {
543 length += m_tagList[i].GetTagLen();
544 length += sizeof(ec_tagname_t) + sizeof(ec_tagtype_t) + sizeof(ec_taglen_t) + ((m_tagList[i].GetTagCount() > 0) ? 2 : 0);
546 return length;
550 uint64_t CECTag::GetInt() const
552 if (m_tagData == NULL) {
553 // Empty tag - This is NOT an error.
554 EC_ASSERT(m_dataType == EC_TAGTYPE_UNKNOWN);
555 return 0;
558 switch (m_dataType) {
559 case EC_TAGTYPE_UINT8:
560 return PeekUInt8(m_tagData);
561 case EC_TAGTYPE_UINT16:
562 return ENDIAN_NTOHS( RawPeekUInt16( m_tagData ) );
563 case EC_TAGTYPE_UINT32:
564 return ENDIAN_NTOHL( RawPeekUInt32( m_tagData ) );
565 case EC_TAGTYPE_UINT64:
566 return ENDIAN_NTOHLL( RawPeekUInt64( m_tagData ) );
567 case EC_TAGTYPE_UNKNOWN:
568 // Empty tag - This is NOT an error.
569 return 0;
570 default:
571 EC_ASSERT(0);
572 return 0;
577 std::string CECTag::GetStringDataSTL() const
579 if (m_dataType != EC_TAGTYPE_STRING) {
580 EC_ASSERT(m_dataType == EC_TAGTYPE_UNKNOWN);
581 return std::string();
582 } else if (m_tagData == NULL) {
583 EC_ASSERT(false);
584 return std::string();
587 return std::string(m_tagData);
591 #ifdef USE_WX_EXTENSIONS
592 wxString CECTag::GetStringData() const
594 return UTF82unicode(GetStringDataSTL().c_str());
596 #endif
599 CMD4Hash CECTag::GetMD4Data() const
601 if (m_dataType != EC_TAGTYPE_HASH16) {
602 EC_ASSERT(m_dataType == EC_TAGTYPE_UNKNOWN);
603 return CMD4Hash();
606 EC_ASSERT(m_tagData != NULL);
608 // Doesn't matter if m_tagData is NULL in CMD4Hash(),
609 // that'll just result in an empty hash.
610 return CMD4Hash((const unsigned char *)m_tagData);
615 * Returns an EC_IPv4_t class.
617 * This function takes care of the enadianness of the port number.
619 * @return EC_IPv4_t class.
621 * @see CECTag(ec_tagname_t, const EC_IPv4_t&)
623 EC_IPv4_t CECTag::GetIPv4Data() const
625 EC_IPv4_t p(0, 0);
627 if (m_dataType != EC_TAGTYPE_IPV4) {
628 EC_ASSERT(m_dataType == EC_TAGTYPE_UNKNOWN);
629 } else if (m_tagData == NULL) {
630 EC_ASSERT(false);
631 } else {
632 RawPokeUInt32( p.m_ip, RawPeekUInt32( ((EC_IPv4_t *)m_tagData)->m_ip ) );
633 p.m_port = ENDIAN_NTOHS(((EC_IPv4_t *)m_tagData)->m_port);
636 return p;
640 * Returns a double value.
642 * @note The returned value is what we get by converting the string form
643 * of the number to a double.
645 * @return The double value of the tag.
647 * @see CECTag(ec_tagname_t, double)
649 double CECTag::GetDoubleData(void) const
651 if (m_dataType != EC_TAGTYPE_DOUBLE) {
652 EC_ASSERT(m_dataType == EC_TAGTYPE_UNKNOWN);
653 return 0;
654 } else if (m_tagData == NULL) {
655 EC_ASSERT(false);
656 return 0;
659 std::istringstream double_str(m_tagData);
661 double data;
662 double_str >> data;
663 return data;
667 void CECTag::ConstructStringTag(ec_tagname_t name, const std::string& data)
669 m_tagName = name;
670 m_dataLen = (ec_taglen_t)strlen(data.c_str()) + 1;
671 NewData();
672 memcpy(m_tagData, data.c_str(), m_dataLen);
673 m_dataType = EC_TAGTYPE_STRING;
676 void CECTag::SetStringData(const wxString& s)
678 if (IsString()) {
679 delete [] m_tagData;
680 ConstructStringTag(m_tagName, (const char*)unicode2UTF8(s));
684 #if __DEBUG__
685 void CECTag::DebugPrint(int level, bool print_empty) const
687 if (m_dataLen || print_empty) {
688 wxString space;
689 for (int i = level; i--;) space += wxT(" ");
690 wxString s1 = CFormat(wxT("%s%s %d = ")) % space % GetDebugNameECTagNames(m_tagName) % m_dataLen;
691 wxString s2;
692 switch (m_tagName) {
693 case EC_TAG_DETAIL_LEVEL:
694 s2 = GetDebugNameEC_DETAIL_LEVEL(GetInt()); break;
695 case EC_TAG_SEARCH_TYPE:
696 s2 = GetDebugNameEC_SEARCH_TYPE(GetInt()); break;
697 case EC_TAG_STAT_VALUE_TYPE:
698 s2 = GetDebugNameEC_STATTREE_NODE_VALUE_TYPE(GetInt()); break;
699 default:
700 switch (m_dataType) {
701 case EC_TAGTYPE_UINT8:
702 case EC_TAGTYPE_UINT16:
703 case EC_TAGTYPE_UINT32:
704 case EC_TAGTYPE_UINT64:
705 s2 = CFormat(wxT("%d")) % GetInt(); break;
706 case EC_TAGTYPE_STRING:
707 s2 = GetStringData(); break;
708 case EC_TAGTYPE_DOUBLE:
709 s2 = CFormat(wxT("%.1f")) % GetDoubleData(); break;
710 case EC_TAGTYPE_HASH16:
711 s2 = GetMD4Data().Encode(); break;
712 case EC_TAGTYPE_CUSTOM:
713 if (m_dataLen == 0) {
714 s2 = wxT("empty");
715 } else {
716 // Make a hex dump (limited to maxOutput)
717 const int maxOutput = 50;
718 for (uint32 i = 0; i < m_dataLen; i++) {
719 if (i == maxOutput) {
720 s2 += wxT("...");
721 break;
723 s2 += CFormat(wxT("%02X ")) % (unsigned char) m_tagData[i];
726 break;
727 default:
728 s2 = GetDebugNameECTagTypes(m_dataType);
731 DoECLogLine(s1 + s2);
733 for (TagList::const_iterator it = m_tagList.begin(); it != m_tagList.end(); ++it) {
734 it->DebugPrint(level + 1, true);
737 #endif
740 * \fn CMD4Hash CECTag::GetMD4Data(void) const
742 * \brief Returns a CMD4Hash class.
744 * This function takes care of converting from MSB to LSB as necessary.
746 * \return CMD4Hash class.
748 * \sa CECTag(ec_tagname_t, const CMD4Hash&)
752 * \fn CECTag *CECTag::GetTagByIndex(size_t index) const
754 * \brief Finds the indexth child tag.
756 * \param index 0-based index, 0 <= \e index < GetTagCount()
758 * \return The child tag, or NULL if index out of range.
762 * \fn CECTag *CECTag::GetTagByIndexSafe(size_t index) const
764 * \brief Finds the indexth child tag.
766 * \param index 0-based index, 0 <= \e index < GetTagCount()
768 * \return The child tag, or a special null-valued tag if index out of range.
772 * \fn size_t CECTag::GetTagCount(void) const
774 * \brief Returns the number of child tags.
776 * \return The number of child tags.
780 * \fn const void *CECTag::GetTagData(void) const
782 * \brief Returns a pointer to the TAG DATA.
784 * \return A pointer to the TAG DATA. (As specified with the data field of the constructor.)
788 * \fn uint16 CECTag::GetTagDataLen(void) const
790 * \brief Returns the length of the data buffer.
792 * \return The length of the data buffer.
796 * \fn ec_tagname_t CECTag::GetTagName(void) const
798 * \brief Returns TAGNAME.
800 * \return The name of the tag.
804 * \fn wxString CECTag::GetStringData(void) const
806 * \brief Returns the string data of the tag.
808 * Returns a wxString created from TAGDATA. It is automatically
809 * converted from UTF-8 to the internal application encoding.
810 * Should be used with care (only on tags created with the
811 * CECTag(ec_tagname_t, const wxString&) constructor),
812 * becuse it does not perform any check to see if the tag really contains a
813 * string object.
815 * \return The string data of the tag.
817 * \sa CECTag(ec_tagname_t, const wxString&)
821 * \fn uint8 CECTag::GetInt(void) const
823 * \brief Returns the uint8 data of the tag.
825 * This function takes care of the endianness problems with numbers.
827 * \return The uint8 data of the tag.
829 * \sa CECTag(ec_tagname_t, uint8)
833 * \fn uint16 CECTag::GetInt(void) const
835 * \brief Returns the uint16 data of the tag.
837 * This function takes care of the endianness problems with numbers.
839 * \return The uint16 data of the tag.
841 * \sa CECTag(ec_tagname_t, uint16)
845 * \fn uint32 CECTag::GetInt(void) const
847 * \brief Returns the uint32 data of the tag.
849 * This function takes care of the endianness problems with numbers.
851 * \return The uint32 data of the tag.
853 * \sa CECTag(ec_tagname_t, uint32)
857 * \fn uint64 CECTag::GetInt(void) const
859 * \brief Returns the uint64 data of the tag.
861 * This function takes care of the endianness problems with numbers.
863 * \return The uint64 data of the tag.
865 * \sa CECTag(ec_tagname_t, uint64)
867 // File_checked_for_headers