Hugin trunk 0.1
Loading...
Searching...
No Matches
Namespaces | Macros | Functions
utils.h File Reference
#include <hugin_shared.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <cassert>
#include <vigra/imageinfo.hxx>
#include <lcms2.h>
#include <hugin_utils/platform.h>
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  hugin_utils
 namespace for various utils
 

Macros

#define DEBUG_HEADER   hugin_utils::GetCurrentTimeString() <<" (" << __FILE__ << ":" << __LINE__ << ") " << __func__ << "(): "
 
#define DEBUG_TRACE(msg)
 
#define DEBUG_DEBUG(msg)
 
#define DEBUG_INFO(msg)
 
#define DEBUG_NOTICE(msg)
 
#define DEBUG_WARN(msg)   { std::cerr << "WARN: " << DEBUG_HEADER << msg << std::endl; }
 
#define DEBUG_ERROR(msg)   { std::cerr << "ERROR: " << DEBUG_HEADER << msg << std::endl; }
 
#define DEBUG_FATAL(msg)   { std::cerr << "FATAL: " << DEBUG_HEADER << "(): " << msg << std::endl; }
 
#define DEBUG_ASSERT(cond)   assert(cond)
 
#define UTILS_THROW(class, msg)   { std::stringstream o; o << msg; throw(class(o.str().c_str())); };
 

Functions

std::string hugin_utils::GetCurrentTimeString ()
 current time as a string
 
std::string hugin_utils::doubleToString (double d, int fractionaldigits=-1)
 convert a double to a string, suitable for display within a GUI.
 
template<typename STR >
bool hugin_utils::stringToDouble (const STR &str_, double &dest)
 convert a string to a double, ignore localisation.
 
bool hugin_utils::stringToInt (const std::string &s, int &val)
 convert string to integer value, returns true, if sucessful
 
bool hugin_utils::stringToUInt (const std::string &s, unsigned int &val)
 convert string to unsigned integer value, returns true, if sucessful
 
std::string hugin_utils::getPathPrefix (const std::string &filename)
 Get the path to a filename.
 
std::string hugin_utils::getExtension (const std::string &basename)
 Get extension of a filename.
 
std::string hugin_utils::stripPath (const std::string &filename)
 remove the path of a filename (mainly useful for gui display of filenames)
 
std::string hugin_utils::stripExtension (const std::string &basename)
 remove extension of a filename
 
std::string hugin_utils::StrTrim (const std::string &str)
 remove trailing and leading white spaces and tabs
 
std::vector< std::string > hugin_utils::SplitString (const std::string &s, const std::string &sep)
 split string s at given sep, returns vector of strings
 
void hugin_utils::ReplaceAll (std::string &s, const std::string &oldChar, char newChar)
 replace all characters oldChar in s with newChar
 
bool hugin_utils::StringContainsCaseInsensitive (const std::string &s1, const std::string &s2)
 check if s1 contains s2 using case insensitive comparison
 
template<class str >
str hugin_utils::QuoteStringInternal (const str &arg, const str &quotechar, const str &replacements)
 
void hugin_utils::ControlPointErrorColour (const double cperr, double &r, double &g, double &b)
 
bool hugin_utils::FileExists (const std::string &filename)
 checks if file exists
 
std::string hugin_utils::GetAbsoluteFilename (const std::string &filename)
 returns the full absolute filename
 
bool hugin_utils::IsFileTypeSupported (const std::string &filename)
 return true, if file type by extension is supported by vigra
 
void hugin_utils::EnforceExtension (std::string &filename, const std::string &defaultExtension)
 check if filename contains extension, if not add default extension
 
std::string hugin_utils::GetOutputFilename (const std::string &out, const std::string &in, const std::string &suffix)
 construct output filename, if ouput is known return this value otherwise use the input filename and append the suffix before the extension
 
std::string hugin_utils::GetDataDir ()
 returns the full path to the data directory
 
std::string hugin_utils::GetUserAppDataDir ()
 returns the directory for user specific Hugin settings, e.g.
 
bool hugin_utils::initGPU (int *argcp, char **argv)
 Try to initalise GLUT and GLEW, and create an OpenGL context for GPU stitching.
 
bool hugin_utils::wrapupGPU ()
 cleanup GPU settings
 
std::string hugin_utils::GetHuginVersion ()
 return a string with version numbers
 
std::string hugin_utils::GetICCDesc (const vigra::ImageImportInfo::ICCProfile &iccProfile)
 returns description of given icc profile
 
std::string hugin_utils::GetICCDesc (const cmsHPROFILE &profile)
 
bool hugin_utils::IsLinearICCProfile (const vigra::ImageImportInfo::ICCProfile &iccProfile)
 return true if icc profile is linear one, otherwise return false
 
std::vector< std::string > hugin_utils::GetRawExtensions ()
 return vector of known extensions of raw files, all lower case
 
bool hugin_utils::IsRawExtension (const std::string testExt)
 return true if extension belongs to a raw file
 
bool hugin_utils::CheckInterpolator (int value)
 check that interpolator number is valid
 

Detailed Description

Author
Pablo d'Angelo pablo.nosp@m..dan.nosp@m.gelo@.nosp@m.web..nosp@m.de

$Id$

This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with this software. If not, see http://www.gnu.org/licenses/.

Definition in file utils.h.

Macro Definition Documentation

◆ DEBUG_ASSERT

#define DEBUG_ASSERT (   cond)    assert(cond)

Definition at line 80 of file utils.h.

◆ DEBUG_DEBUG

#define DEBUG_DEBUG (   msg)

Definition at line 68 of file utils.h.

◆ DEBUG_ERROR

#define DEBUG_ERROR (   msg)    { std::cerr << "ERROR: " << DEBUG_HEADER << msg << std::endl; }

Definition at line 76 of file utils.h.

◆ DEBUG_FATAL

#define DEBUG_FATAL (   msg)    { std::cerr << "FATAL: " << DEBUG_HEADER << "(): " << msg << std::endl; }

Definition at line 78 of file utils.h.

◆ DEBUG_HEADER

#define DEBUG_HEADER   hugin_utils::GetCurrentTimeString() <<" (" << __FILE__ << ":" << __LINE__ << ") " << __func__ << "(): "

Definition at line 53 of file utils.h.

◆ DEBUG_INFO

#define DEBUG_INFO (   msg)

Definition at line 69 of file utils.h.

◆ DEBUG_NOTICE

#define DEBUG_NOTICE (   msg)

Definition at line 70 of file utils.h.

◆ DEBUG_TRACE

#define DEBUG_TRACE (   msg)

Definition at line 67 of file utils.h.

◆ DEBUG_WARN

#define DEBUG_WARN (   msg)    { std::cerr << "WARN: " << DEBUG_HEADER << msg << std::endl; }

Definition at line 74 of file utils.h.

◆ UTILS_THROW

#define UTILS_THROW (   class,
  msg 
)    { std::stringstream o; o << msg; throw(class(o.str().c_str())); };

Definition at line 83 of file utils.h.