Commit fd46e861 authored by Max Lyon's avatar Max Lyon

add DebFileOut files

parent 90733ffb
Pipeline #495 skipped
#include "DebFileOut.hh"
#include <string>
#include <sstream>
#include <iomanip>
namespace Debug {
std::string make_filename(const char* _prfx, const char* _flnm,
const char* _ext, const char* _sfx)
{
static int cnt = 0;
const char SEP = '_';
std::stringstream sstr_flnm;
sstr_flnm << std::setfill('0') << std::setw(4) << cnt++;
sstr_flnm << SEP << _prfx << SEP << _flnm;
if (_sfx != nullptr)
sstr_flnm << SEP << _sfx;
sstr_flnm << '.' << _ext;
return sstr_flnm.str();
}
std::string set_filename_extension(const char* _flnm, const char* _ext)
{
std::string flnm(_flnm);
const size_t dot_pos = flnm.find_last_of('.');
if (dot_pos != std::string::npos)
flnm.replace(flnm.begin() + dot_pos + 1, flnm.end(), _ext);
else
flnm += std::string(".") + _ext;
return flnm;
}
} // Debug
// (C) Copyright 2014 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary
// to Autodesk, Inc., and considered a trade secret as defined
// in section 499C of the penal code of the State of California.
// Use of this information by anyone other than authorized
// employees of Autodesk, Inc. is granted only under a written
// non-disclosure agreement, expressly prescribing the scope
// and manner of such use.
#ifndef BASE_DEBFILEOUT_HH_INCLUDED
#define BASE_DEBFILEOUT_HH_INCLUDED
#ifdef DEB_ON
#include <string>
namespace Debug {
//! Make a file name composing the input arguments:
// prefix_filname_[suffix_]#count#.ext
// count is a number that increase any time the function is called,
// it is expressed with 4 decimal digits filled with zeros.
std::string make_filename(const char* _prfx, const char* _flnm,
const char* _ext, const char* _sfx = nullptr);
std::string set_filename_extension(const char* _flnm, const char* _ext);
} // Debug
#endif // DEB_ON
#endif // BASE_DEBFILEOUT_HH_INCLUDED
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment