diff --git a/intelhex_class/intelhexclass.cpp b/intelhex_class/intelhexclass.cpp index 49f20bb..593fcb5 100644 --- a/intelhex_class/intelhexclass.cpp +++ b/intelhex_class/intelhexclass.cpp @@ -479,7 +479,9 @@ istream& operator>>(istream& dataIn, intelhex& ihLocal) if (ihLocal.verbose == true) { cout << "Data Record begining @ 0x" << - ihLocal.ulToHexString(loadOffset) << endl; + ihLocal.ulToHexString(loadOffset) << + " size 0x" << + ihLocal.ulToHexString(recordLength) << endl; } break; diff --git a/intelhex_class/intelhexclass.h b/intelhex_class/intelhexclass.h index d9641ed..381d3a2 100644 --- a/intelhex_class/intelhexclass.h +++ b/intelhex_class/intelhexclass.h @@ -59,7 +59,7 @@ * DEFINES *******************************************************************************/ -using namespace std; +//using namespace std; /******************************************************************************/ /*! \cond @@ -90,7 +90,7 @@ class intelhex { * * \retval - pointer to output stream ***********************************************************************/ - friend ostream& operator<<(ostream& dataOut, + friend std::ostream& operator<<(std::ostream& dataOut, intelhex& ihLocal); /**********************************************************************/ @@ -107,7 +107,7 @@ class intelhex { * * \retval - pointer to input stream ***********************************************************************/ - friend istream& operator>>(istream& dataIn, + friend std::istream& operator>>(std::istream& dataIn, intelhex& ihLocal); private: @@ -117,7 +117,7 @@ class intelhex { * STL map holding the addresses found in the Intel HEX file and the * associated data byte stored at that address ***********************************************************************/ - map ihContent; + std::map ihContent; /**********************************************************************/ /*! \brief Iterator for the container holding the decoded Intel HEX @@ -127,7 +127,7 @@ class intelhex { * currently being used to read or write data. If no file has been * loaded into memory, it points to the start of ihContent. ***********************************************************************/ - map::iterator ihIterator; + std::map::iterator ihIterator; /**********************************************************************/ /*! \brief Pair for the container holding the decoded Intel HEX content. @@ -138,7 +138,7 @@ class intelhex { * can ensure that no address in a file is falsely assigned data more * than once. ***********************************************************************/ - pair::iterator,bool> ihReturn; + std::pair::iterator,bool> ihReturn; /**********************************************************************/ /*! \brief Stores segment base address of Intel HEX file. @@ -208,7 +208,7 @@ class intelhex { * the list ***********************************************************************/ struct { - list ihWarnings; + std::list ihWarnings; unsigned long noOfWarnings; } msgWarning; @@ -223,7 +223,7 @@ class intelhex { * list ***********************************************************************/ struct { - list ihErrors; + std::list ihErrors; unsigned long noOfErrors; } msgError; @@ -273,7 +273,7 @@ class intelhex { * * \sa ulToHexString(), ucToHexString(), ulToString() ***********************************************************************/ - unsigned char stringToHex(string value); + unsigned char stringToHex(std::string value); /*********************************************************************** * \brief Converts an unsigned long to a string in HEX format. @@ -292,7 +292,7 @@ class intelhex { * \sa * stringToHex(), ucToHexString(), ulToString() ***********************************************************************/ - string ulToHexString(unsigned long value); + std::string ulToHexString(unsigned long value); /**********************************************************************/ /*! \brief Converts an unsigned char to a string in HEX format. @@ -311,7 +311,7 @@ class intelhex { * \sa * stringToHex(), ulToHexString(), ulToString() ***********************************************************************/ - string ucToHexString(unsigned char value); + std::string ucToHexString(unsigned char value); /**********************************************************************/ /*! \brief Converts an unsigned long to a string in DEC format. @@ -327,7 +327,7 @@ class intelhex { * \sa * stringToHex(), ulToHexString(), ucToHexString() ***********************************************************************/ - string ulToString(unsigned long value); + std::string ulToString(unsigned long value); /**********************************************************************/ /*! \brief Decodes the data content of a data record. @@ -346,7 +346,7 @@ class intelhex { ***********************************************************************/ void decodeDataRecord(unsigned char recordLength, unsigned long loadOffset, - string::const_iterator data); + std::string::const_iterator data); /**********************************************************************/ /*! \brief Add a warning message to the warning message list. @@ -354,14 +354,14 @@ class intelhex { * * \param warningMessage - the text to be added for this warning ***********************************************************************/ - void addWarning(string warningMessage); + void addWarning(std::string warningMessage); /**********************************************************************/ /*! \brief Add an error message to the error message list. * * \param errorMessage - the text to be added for this error ***********************************************************************/ - void addError(string errorMessage); + void addError(std::string errorMessage); public: /**********************************************************************/ @@ -615,15 +615,7 @@ class intelhex { if (!ihContent.empty()) { - map::iterator it \ - = ihContent.end(); - - --it; - - if (it != ihIterator) - { - result = false; - } + return ihIterator == ihContent.end(); } return result; } @@ -661,7 +653,7 @@ class intelhex { if (ihContent.size() != 0) { - map::iterator it; + std::map::iterator it; it = ihContent.find(address); if (it != ihContent.end()) { @@ -774,7 +766,7 @@ class intelhex { { if (ihContent.size() != 0) { - map::iterator it; + std::map::iterator it; it = ihContent.begin(); *address = (*it).first; @@ -802,7 +794,7 @@ class intelhex { { if (ihContent.size() != 0) { - map::reverse_iterator rit; + std::map::reverse_iterator rit; rit = ihContent.rbegin(); *address = (*rit).first; @@ -858,7 +850,7 @@ class intelhex { bool getData(unsigned char * data, unsigned long address) { bool found = false; - map::iterator localIterator; + std::map::iterator localIterator; if (!ihContent.empty()) { @@ -979,7 +971,7 @@ class intelhex { * * \sa getNoWarnings(), getNoErrors(), popNextError() ***********************************************************************/ - bool popNextWarning(string& warning) + bool popNextWarning(std::string& warning) { if (msgWarning.noOfWarnings > 0) { @@ -1010,7 +1002,7 @@ class intelhex { * * \sa getNoWarnings(), getNoErrors(), popNextError() ***********************************************************************/ - bool popNextError(string& error) + bool popNextError(std::string& error) { if (msgError.noOfErrors > 0) {