Definition in file utils.h.
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <hn/osdep.h>
#include <hn/endian.h>
#include <hn/gettickcount.h>
#include <sys/stat.h>
#include <boost/static_assert.hpp>
#include <boost/scoped_array.hpp>
#include <boost/shared_array.hpp>
#include <boost/filesystem/path.hpp>
Include dependency graph for utils.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Namespaces | |
| namespace | Utils |
Specializations for reading various datas | |
| template<class T> | |
| T | getVal (std::istream &i) |
| Primary template is not implemented, and causes compile-time error if instanciated. | |
| template<class T> | |
| T | getVal (std::istream &i, uint16_t len) |
Writing function template specializations. | |
| template<> | |
| void | putVal (std::ostream &o, uint8_t val) |
| template<> | |
| void | putVal (std::ostream &o, uint16_t val) |
| template<> | |
| void | putVal (std::ostream &o, uint32_t val) |
| template<> | |
| void | putVal (std::ostream &o, uint64_t val) |
| template<> | |
| void | putVal (std::ostream &o, float val) |
| template<> | |
| void | putVal (std::ostream &o, const std::string &str) |
| template<> | |
| void | putVal (std::ostream &o, std::string str) |
| void | putVal (std::ostream &o, const std::string &str, uint16_t len) |
| void | putVal (std::ostream &o, const char *const str, uint16_t len) |
| void | putVal (std::ostream &o, const uint8_t *const str, uint16_t len) |
| void | putVal (std::ostream &o, const boost::shared_array< char > &str, uint16_t len) |
Functions | |
| std::string | decode (const std::string &data) |
| std::string | decode (const std::string &data, uint32_t length) |
| std::string | decode (boost::shared_array< char > data, uint32_t len) |
| std::string | encode (const std::string &data) |
| std::string | encode (const std::string &data, uint32_t length) |
| std::string | encode (boost::shared_array< char > data, uint32_t len) |
| void | copyString (const char *src, char *&dest) |
| Copy string from source to destination, overwriting destination memory. | |
| uint64_t | getFileSize (const boost::filesystem::path &loc) |
| Retrieve the size of a file. | |
| uint32_t | getModDate (const boost::filesystem::path &loc) |
| Retrieve the last modification date of a file. | |
| template<class T> | |
| void | putVal (std::ostream &o, T val) |
| Write. | |
| template<class T> | |
| std::ostream & | hexDump (std::ostream &o, T val) |
| Dumps the hexadecimal representation of a value to stream. | |
| template<typename T> | |
| std::string | hexDump (T val) |
| Creates hexadecimal dump of value into a string. | |
| template<typename T> | |
| std::string | hexDump (T *val) |
| Specalization - for dumping pointer types. | |
| std::string | bytesToString (uint64_t bytes) |
| Convert bytes to string representation. | |
|
|
Convert bytes to string representation.
Definition at line 392 of file utils.h. Referenced by SchedBase::handleEvents(), PartData::printCompleted(), and FilesList::~FilesList(). |
|
||||||||||||
|
Copy string from source to destination, overwriting destination memory. This function assumes source string is null-terminated, and copies until the terminating zero (including it). The destination pointer is passed by reference and modified as neccesery during memory reallocations to point to newly allocated memory region.
Definition at line 90 of file utils.h. Referenced by AudioMetaData::setAlbum(), AudioMetaData::setArtist(), ImageMetaData::setComment(), ArchiveMetaData::setComment(), AudioMetaData::setComment(), AudioMetaData::setComposer(), AudioMetaData::setCopyright(), AudioMetaData::setEncoded(), AudioMetaData::setGenre(), AudioMetaData::setOrigArtist(), AudioMetaData::setTitle(), and AudioMetaData::setUrl(). |
|
||||||||||||
|
Definition at line 67 of file utils.h. References Utils::decode(). |
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 64 of file utils.h. References Utils::decode(). |
Here is the call graph for this function:

|
|
Definition at line 61 of file utils.h. References Utils::decode(). |
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 76 of file utils.h. References Utils::encode(). |
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 73 of file utils.h. References Utils::encode(). |
Here is the call graph for this function:

|
|
Definition at line 70 of file utils.h. References Utils::encode(). |
Here is the call graph for this function:

|
|
Retrieve the size of a file.
Definition at line 106 of file utils.h. Referenced by SharedFile::findMetaData(), HashWork::finish(), and HashWork::initState(). |
|
|
Retrieve the last modification date of a file.
Definition at line 118 of file utils.h. Referenced by SharedFile::findMetaData(), HashWork::finish(), HydraNode::init(), PartData::PartData(), and SharedFile::read(). |
|
||||||||||||||||
|
|
|
||||||||||
|
Primary template is not implemented, and causes compile-time error if instanciated.
|
|
||||||||||
|
Specalization - for dumping pointer types. Note: using p argument at boost::format generally works better and is more readable for this purpose...
|
|
||||||||||
|
Creates hexadecimal dump of value into a string.
|
|
||||||||||||||||
|
Dumps the hexadecimal representation of a value to stream.
|
|
||||||||||||||||
|
Definition at line 291 of file utils.h. References CHECK_THROW. |
|
||||||||||||||||
|
Definition at line 285 of file utils.h. References CHECK_THROW. |
|
||||||||||||||||
|
Definition at line 279 of file utils.h. References CHECK_THROW. |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 259 of file utils.h. References SWAP32_ON_BE. |
|
||||||||||||||||
|
Definition at line 253 of file utils.h. References SWAP64_ON_BE. |
|
||||||||||||||||
|
Definition at line 247 of file utils.h. References SWAP32_ON_BE. |
|
||||||||||||||||
|
Definition at line 241 of file utils.h. References SWAP16_ON_BE. |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Write. Primary template not implemented and causes compile-time failure if instanciated. Definition at line 229 of file utils.h. Referenced by operator<<(). |