mirror of https://github.com/stella-emu/stella.git
Merge remote-tracking branch 'remotes/origin/master' into feature/dbg-save-as-dialog
This commit is contained in:
commit
fee6139efe
|
@ -106,21 +106,6 @@ class FilesystemNodeZIP : public AbstractFSNode
|
||||||
|
|
||||||
// ZipHandler static reference variable responsible for accessing ZIP files
|
// ZipHandler static reference variable responsible for accessing ZIP files
|
||||||
static unique_ptr<ZipHandler> myZipHandler;
|
static unique_ptr<ZipHandler> myZipHandler;
|
||||||
|
|
||||||
// Get last component of path
|
|
||||||
static const char* lastPathComponent(const string& str)
|
|
||||||
{
|
|
||||||
if(str.empty())
|
|
||||||
return "";
|
|
||||||
|
|
||||||
const char* start = str.c_str();
|
|
||||||
const char* cur = start + str.size() - 2;
|
|
||||||
|
|
||||||
while (cur >= start && *cur != FilesystemNode::PATH_SEPARATOR)
|
|
||||||
--cur;
|
|
||||||
|
|
||||||
return cur + 1;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -57,15 +57,9 @@ void AtariNTSC::generateKernels()
|
||||||
const uInt8* ptr = myRGBPalette.data();
|
const uInt8* ptr = myRGBPalette.data();
|
||||||
for(size_t entry = 0; entry < myRGBPalette.size() / 3; ++entry)
|
for(size_t entry = 0; entry < myRGBPalette.size() / 3; ++entry)
|
||||||
{
|
{
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
float r = myImpl.to_float[*ptr++],
|
|
||||||
g = myImpl.to_float[*ptr++],
|
|
||||||
b = myImpl.to_float[*ptr++];
|
|
||||||
#else
|
|
||||||
float r = (*ptr++) / 255.F * rgb_unit + rgb_offset,
|
float r = (*ptr++) / 255.F * rgb_unit + rgb_offset,
|
||||||
g = (*ptr++) / 255.F * rgb_unit + rgb_offset,
|
g = (*ptr++) / 255.F * rgb_unit + rgb_offset,
|
||||||
b = (*ptr++) / 255.F * rgb_unit + rgb_offset;
|
b = (*ptr++) / 255.F * rgb_unit + rgb_offset;
|
||||||
#endif
|
|
||||||
float y, i, q; RGB_TO_YIQ( r, g, b, y, i, q );
|
float y, i, q; RGB_TO_YIQ( r, g, b, y, i, q );
|
||||||
|
|
||||||
// Generate kernel
|
// Generate kernel
|
||||||
|
@ -325,11 +319,6 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void AtariNTSC::init(init_t& impl, const Setup& setup)
|
void AtariNTSC::init(init_t& impl, const Setup& setup)
|
||||||
{
|
{
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
impl.brightness = setup.brightness * (0.5F * rgb_unit) + rgb_offset;
|
|
||||||
impl.contrast = setup.contrast * (0.5F * rgb_unit) + rgb_unit;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
impl.artifacts = setup.artifacts;
|
impl.artifacts = setup.artifacts;
|
||||||
if ( impl.artifacts > 0 )
|
if ( impl.artifacts > 0 )
|
||||||
impl.artifacts *= artifacts_max - artifacts_mid;
|
impl.artifacts *= artifacts_max - artifacts_mid;
|
||||||
|
@ -342,30 +331,8 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
|
||||||
|
|
||||||
initFilters(impl, setup);
|
initFilters(impl, setup);
|
||||||
|
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
/* generate gamma table */
|
|
||||||
if (true) /* was (gamma_size > 1) */
|
|
||||||
{
|
|
||||||
float const to_float = 1.F / (gamma_size - 1/*(gamma_size > 1)*/);
|
|
||||||
float const gamma = 1.1333F - setup.gamma * 0.5F;
|
|
||||||
/* match common PC's 2.2 gamma to TV's 2.65 gamma */
|
|
||||||
int i;
|
|
||||||
for(i = 0; i < gamma_size; i++)
|
|
||||||
impl.to_float[i] =
|
|
||||||
powf(i * to_float, gamma) * impl.contrast + impl.brightness;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* setup decoder matricies */
|
/* setup decoder matricies */
|
||||||
{
|
{
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
float hue = setup.hue * BSPF::PI_f + BSPF::PI_f / 180 * ext_decoder_hue;
|
|
||||||
float sat = setup.saturation + 1;
|
|
||||||
hue += BSPF::PI_f / 180 * (std_decoder_hue - ext_decoder_hue);
|
|
||||||
|
|
||||||
float s = sinf(hue)*sat;
|
|
||||||
float c = cosf(hue)*sat;
|
|
||||||
#endif
|
|
||||||
float* out = impl.to_rgb.data();
|
float* out = impl.to_rgb.data();
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
@ -378,13 +345,8 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
|
||||||
{
|
{
|
||||||
float i = *in++;
|
float i = *in++;
|
||||||
float q = *in++;
|
float q = *in++;
|
||||||
#ifdef BLARGG_PALETTE
|
*out++ = i;
|
||||||
*out++ = i * c - q * s;
|
|
||||||
*out++ = i * s + q * c;
|
|
||||||
#else
|
|
||||||
*out++ = i ;
|
|
||||||
*out++ = q;
|
*out++ = q;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
while ( --n2 );
|
while ( --n2 );
|
||||||
#if 0 // burst_count is always 0
|
#if 0 // burst_count is always 0
|
||||||
|
@ -561,32 +523,16 @@ void AtariNTSC::genKernel(init_t& impl, float y, float i, float q, uInt32* out)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const AtariNTSC::Setup AtariNTSC::TV_Composite = {
|
const AtariNTSC::Setup AtariNTSC::TV_Composite = {
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.15F, 0.0F, 0.0F, 0.0F
|
|
||||||
#else
|
|
||||||
0.0F, 0.15F, 0.0F, 0.0F, 0.0F
|
0.0F, 0.15F, 0.0F, 0.0F, 0.0F
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
const AtariNTSC::Setup AtariNTSC::TV_SVideo = {
|
const AtariNTSC::Setup AtariNTSC::TV_SVideo = {
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.45F, -1.0F, -1.0F, 0.0F
|
|
||||||
#else
|
|
||||||
0.0F, 0.45F, -1.0F, -1.0F, 0.0F
|
0.0F, 0.45F, -1.0F, -1.0F, 0.0F
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
const AtariNTSC::Setup AtariNTSC::TV_RGB = {
|
const AtariNTSC::Setup AtariNTSC::TV_RGB = {
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
0.0F, 0.0F, 0.0F, 0.0F, 0.2F, 0.0F, 0.70F, -1.0F, -1.0F, -1.0F
|
|
||||||
#else
|
|
||||||
0.2F, 0.70F, -1.0F, -1.0F, -1.0F
|
0.2F, 0.70F, -1.0F, -1.0F, -1.0F
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
const AtariNTSC::Setup AtariNTSC::TV_Bad = {
|
const AtariNTSC::Setup AtariNTSC::TV_Bad = {
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
0.1F, -0.3F, 0.3F, 0.25F, 0.2F, 0.0F, 0.1F, 0.5F, 0.5F, 0.5F
|
|
||||||
#else
|
|
||||||
0.2F, 0.1F, 0.5F, 0.5F, 0.5F
|
0.2F, 0.1F, 0.5F, 0.5F, 0.5F
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
#include "FrameBufferConstants.hxx"
|
#include "FrameBufferConstants.hxx"
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
//#define BLARGG_PALETTE // also modify contrast, brightness, saturation, gamma and hue when defined
|
|
||||||
|
|
||||||
class AtariNTSC
|
class AtariNTSC
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -59,18 +57,9 @@ class AtariNTSC
|
||||||
struct Setup
|
struct Setup
|
||||||
{
|
{
|
||||||
// Basic parameters
|
// Basic parameters
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
float hue{0.F}; // -1 = -180 degrees +1 = +180 degrees
|
|
||||||
float saturation{0.F}; // -1 = grayscale (0.0) +1 = oversaturated colors (2.0)
|
|
||||||
float contrast{0.F}; // -1 = dark (0.5) +1 = light (1.5)
|
|
||||||
float brightness{0.F}; // -1 = dark (0.5) +1 = light (1.5)
|
|
||||||
#endif
|
|
||||||
float sharpness{0.F}; // edge contrast enhancement/blurring
|
float sharpness{0.F}; // edge contrast enhancement/blurring
|
||||||
|
|
||||||
// Advanced parameters
|
// Advanced parameters
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
float gamma{0.F}; // -1 = dark (1.5) +1 = light (0.5)
|
|
||||||
#endif
|
|
||||||
float resolution{0.F}; // image resolution
|
float resolution{0.F}; // image resolution
|
||||||
float artifacts{0.F}; // artifacts caused by color changes
|
float artifacts{0.F}; // artifacts caused by color changes
|
||||||
float fringing{0.F}; // color artifacts caused by brightness changes
|
float fringing{0.F}; // color artifacts caused by brightness changes
|
||||||
|
@ -133,9 +122,6 @@ class AtariNTSC
|
||||||
burst_size = entry_size / burst_count,
|
burst_size = entry_size / burst_count,
|
||||||
kernel_half = 16,
|
kernel_half = 16,
|
||||||
kernel_size = kernel_half * 2 + 1,
|
kernel_size = kernel_half * 2 + 1,
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
gamma_size = 256,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rgb_builder = ((1 << 21) | (1 << 11) | (1 << 1)),
|
rgb_builder = ((1 << 21) | (1 << 11) | (1 << 1)),
|
||||||
rgb_kernel_size = burst_size / alignment_count,
|
rgb_kernel_size = burst_size / alignment_count,
|
||||||
|
@ -170,20 +156,12 @@ class AtariNTSC
|
||||||
struct init_t
|
struct init_t
|
||||||
{
|
{
|
||||||
std::array<float, burst_count * 6> to_rgb{0.F};
|
std::array<float, burst_count * 6> to_rgb{0.F};
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
std::array<float, gamma_size> to_float{0.F};
|
|
||||||
float contrast{0.F};
|
|
||||||
float brightness{0.F};
|
|
||||||
#endif
|
|
||||||
float artifacts{0.F};
|
float artifacts{0.F};
|
||||||
float fringing{0.F};
|
float fringing{0.F};
|
||||||
std::array<float, rescale_out * kernel_size * 2> kernel{0.F};
|
std::array<float, rescale_out * kernel_size * 2> kernel{0.F};
|
||||||
|
|
||||||
init_t() {
|
init_t() {
|
||||||
to_rgb.fill(0.0);
|
to_rgb.fill(0.0);
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
to_float.fill(0.0);
|
|
||||||
#endif
|
|
||||||
kernel.fill(0.0);
|
kernel.fill(0.0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,19 +77,11 @@ void NTSCFilter::selectAdjustable(int direction,
|
||||||
{
|
{
|
||||||
if(direction == +1)
|
if(direction == +1)
|
||||||
{
|
{
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
myCurrentAdjustable = (myCurrentAdjustable + 1) % 10;
|
|
||||||
#else
|
|
||||||
myCurrentAdjustable = (myCurrentAdjustable + 1) % 5;
|
myCurrentAdjustable = (myCurrentAdjustable + 1) % 5;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if(direction == -1)
|
else if(direction == -1)
|
||||||
{
|
{
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
if(myCurrentAdjustable == 0) myCurrentAdjustable = 9;
|
|
||||||
#else
|
|
||||||
if(myCurrentAdjustable == 0) myCurrentAdjustable = 4;
|
if(myCurrentAdjustable == 0) myCurrentAdjustable = 4;
|
||||||
#endif
|
|
||||||
else --myCurrentAdjustable;
|
else --myCurrentAdjustable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,13 +131,6 @@ void NTSCFilter::loadConfig(const Settings& settings)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Load adjustables for custom mode
|
// Load adjustables for custom mode
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
myCustomSetup.hue = BSPF::clamp(settings.getFloat("tv.hue"), -1.0F, 1.0F);
|
|
||||||
myCustomSetup.saturation = BSPF::clamp(settings.getFloat("tv.saturation"), -1.0F, 1.0F);
|
|
||||||
myCustomSetup.contrast = BSPF::clamp(settings.getFloat("tv.contrast"), -1.0F, 1.0F);
|
|
||||||
myCustomSetup.brightness = BSPF::clamp(settings.getFloat("tv.brightness"), -1.0F, 1.0F);
|
|
||||||
myCustomSetup.gamma = BSPF::clamp(settings.getFloat("tv.gamma"), -1.0F, 1.0F);
|
|
||||||
#endif
|
|
||||||
myCustomSetup.sharpness = BSPF::clamp(settings.getFloat("tv.sharpness"), -1.0F, 1.0F);
|
myCustomSetup.sharpness = BSPF::clamp(settings.getFloat("tv.sharpness"), -1.0F, 1.0F);
|
||||||
myCustomSetup.resolution = BSPF::clamp(settings.getFloat("tv.resolution"), -1.0F, 1.0F);
|
myCustomSetup.resolution = BSPF::clamp(settings.getFloat("tv.resolution"), -1.0F, 1.0F);
|
||||||
myCustomSetup.artifacts = BSPF::clamp(settings.getFloat("tv.artifacts"), -1.0F, 1.0F);
|
myCustomSetup.artifacts = BSPF::clamp(settings.getFloat("tv.artifacts"), -1.0F, 1.0F);
|
||||||
|
@ -157,13 +142,6 @@ void NTSCFilter::loadConfig(const Settings& settings)
|
||||||
void NTSCFilter::saveConfig(Settings& settings) const
|
void NTSCFilter::saveConfig(Settings& settings) const
|
||||||
{
|
{
|
||||||
// Save adjustables for custom mode
|
// Save adjustables for custom mode
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
settings.setValue("tv.hue", myCustomSetup.hue);
|
|
||||||
settings.setValue("tv.saturation", myCustomSetup.saturation);
|
|
||||||
settings.setValue("tv.contrast", myCustomSetup.contrast);
|
|
||||||
settings.setValue("tv.brightness", myCustomSetup.brightness);
|
|
||||||
settings.setValue("tv.gamma", myCustomSetup.gamma);
|
|
||||||
#endif
|
|
||||||
settings.setValue("tv.sharpness", myCustomSetup.sharpness);
|
settings.setValue("tv.sharpness", myCustomSetup.sharpness);
|
||||||
settings.setValue("tv.resolution", myCustomSetup.resolution);
|
settings.setValue("tv.resolution", myCustomSetup.resolution);
|
||||||
settings.setValue("tv.artifacts", myCustomSetup.artifacts);
|
settings.setValue("tv.artifacts", myCustomSetup.artifacts);
|
||||||
|
@ -194,13 +172,6 @@ void NTSCFilter::getAdjustables(Adjustable& adjustable, Preset preset) const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void NTSCFilter::setCustomAdjustables(const Adjustable& adjustable)
|
void NTSCFilter::setCustomAdjustables(const Adjustable& adjustable)
|
||||||
{
|
{
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
//myCustomSetup.hue = scaleFrom100(adjustable.hue);
|
|
||||||
//myCustomSetup.saturation = scaleFrom100(adjustable.saturation);
|
|
||||||
//myCustomSetup.contrast = scaleFrom100(adjustable.contrast);
|
|
||||||
//myCustomSetup.brightness = scaleFrom100(adjustable.brightness);
|
|
||||||
//myCustomSetup.gamma = scaleFrom100(adjustable.gamma);
|
|
||||||
#endif
|
|
||||||
myCustomSetup.sharpness = scaleFrom100(adjustable.sharpness);
|
myCustomSetup.sharpness = scaleFrom100(adjustable.sharpness);
|
||||||
myCustomSetup.resolution = scaleFrom100(adjustable.resolution);
|
myCustomSetup.resolution = scaleFrom100(adjustable.resolution);
|
||||||
myCustomSetup.artifacts = scaleFrom100(adjustable.artifacts);
|
myCustomSetup.artifacts = scaleFrom100(adjustable.artifacts);
|
||||||
|
@ -212,13 +183,6 @@ void NTSCFilter::setCustomAdjustables(const Adjustable& adjustable)
|
||||||
void NTSCFilter::convertToAdjustable(Adjustable& adjustable,
|
void NTSCFilter::convertToAdjustable(Adjustable& adjustable,
|
||||||
const AtariNTSC::Setup& setup) const
|
const AtariNTSC::Setup& setup) const
|
||||||
{
|
{
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
//adjustable.hue = scaleTo100(setup.hue);
|
|
||||||
//adjustable.saturation = scaleTo100(setup.saturation);
|
|
||||||
//adjustable.contrast = scaleTo100(setup.contrast);
|
|
||||||
//adjustable.brightness = scaleTo100(setup.brightness);
|
|
||||||
//adjustable.gamma = scaleTo100(setup.gamma);
|
|
||||||
#endif
|
|
||||||
adjustable.sharpness = scaleTo100(setup.sharpness);
|
adjustable.sharpness = scaleTo100(setup.sharpness);
|
||||||
adjustable.resolution = scaleTo100(setup.resolution);
|
adjustable.resolution = scaleTo100(setup.resolution);
|
||||||
adjustable.artifacts = scaleTo100(setup.artifacts);
|
adjustable.artifacts = scaleTo100(setup.artifacts);
|
||||||
|
@ -230,16 +194,7 @@ void NTSCFilter::convertToAdjustable(Adjustable& adjustable,
|
||||||
AtariNTSC::Setup NTSCFilter::myCustomSetup = AtariNTSC::TV_Composite;
|
AtariNTSC::Setup NTSCFilter::myCustomSetup = AtariNTSC::TV_Composite;
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
const std::array<NTSCFilter::AdjustableTag, 10> NTSCFilter::ourCustomAdjustables = { {
|
|
||||||
{ "contrast", &myCustomSetup.contrast },
|
|
||||||
{ "brightness", &myCustomSetup.brightness },
|
|
||||||
{ "hue", &myCustomSetup.hue },
|
|
||||||
{ "saturation", &myCustomSetup.saturation },
|
|
||||||
{ "gamma", &myCustomSetup.gamma },
|
|
||||||
#else
|
|
||||||
const std::array<NTSCFilter::AdjustableTag, int(NTSCFilter::Adjustables::NUM_ADJUSTABLES)> NTSCFilter::ourCustomAdjustables = { {
|
const std::array<NTSCFilter::AdjustableTag, int(NTSCFilter::Adjustables::NUM_ADJUSTABLES)> NTSCFilter::ourCustomAdjustables = { {
|
||||||
#endif
|
|
||||||
{ "sharpness", &myCustomSetup.sharpness },
|
{ "sharpness", &myCustomSetup.sharpness },
|
||||||
{ "resolution", &myCustomSetup.resolution },
|
{ "resolution", &myCustomSetup.resolution },
|
||||||
{ "artifacts", &myCustomSetup.artifacts },
|
{ "artifacts", &myCustomSetup.artifacts },
|
||||||
|
|
|
@ -59,12 +59,7 @@ class NTSCFilter
|
||||||
/* Normally used in conjunction with custom mode, contains all
|
/* Normally used in conjunction with custom mode, contains all
|
||||||
aspects currently adjustable in NTSC TV emulation. */
|
aspects currently adjustable in NTSC TV emulation. */
|
||||||
struct Adjustable {
|
struct Adjustable {
|
||||||
#ifdef BLARGG_PALETTE
|
uInt32 sharpness{0}, resolution{0}, artifacts{0}, fringing{0}, bleed{0};
|
||||||
uInt32 hue, saturation, contrast, brightness, gamma,
|
|
||||||
sharpness, resolution, artifacts, fringing, bleed;
|
|
||||||
#else
|
|
||||||
uInt32 sharpness, resolution, artifacts, fringing, bleed;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -153,11 +148,7 @@ class NTSCFilter
|
||||||
float* value{nullptr};
|
float* value{nullptr};
|
||||||
};
|
};
|
||||||
uInt32 myCurrentAdjustable{0};
|
uInt32 myCurrentAdjustable{0};
|
||||||
#ifdef BLARGG_PALETTE
|
|
||||||
static const std::array<AdjustableTag, 10> ourCustomAdjustables;
|
|
||||||
#else
|
|
||||||
static const std::array<AdjustableTag, 5> ourCustomAdjustables;
|
static const std::array<AdjustableTag, 5> ourCustomAdjustables;
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
|
@ -478,6 +478,26 @@ class AbstractFSNode
|
||||||
* a try-catch block.
|
* a try-catch block.
|
||||||
*/
|
*/
|
||||||
virtual size_t write(const stringstream& buffer) const { return 0; }
|
virtual size_t write(const stringstream& buffer) const { return 0; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the last component of a given path.
|
||||||
|
*
|
||||||
|
* @param str String containing the path.
|
||||||
|
* @return Pointer to the first char of the last component inside str.
|
||||||
|
*/
|
||||||
|
static const char* lastPathComponent(const string& str)
|
||||||
|
{
|
||||||
|
if(str.empty())
|
||||||
|
return "";
|
||||||
|
|
||||||
|
const char* start = str.c_str();
|
||||||
|
const char* cur = start + str.size() - 2;
|
||||||
|
|
||||||
|
while (cur >= start && *cur != FilesystemNode::PATH_SEPARATOR)
|
||||||
|
--cur;
|
||||||
|
|
||||||
|
return cur + 1;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -89,30 +89,6 @@ class FilesystemNodePOSIX : public AbstractFSNode
|
||||||
* using the stat() function.
|
* using the stat() function.
|
||||||
*/
|
*/
|
||||||
void setFlags();
|
void setFlags();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the last component of a given path.
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* /foo/bar.txt would return /bar.txt
|
|
||||||
* /foo/bar/ would return /bar/
|
|
||||||
*
|
|
||||||
* @param str String containing the path.
|
|
||||||
* @return Pointer to the first char of the last component inside str.
|
|
||||||
*/
|
|
||||||
static const char* lastPathComponent(const string& str)
|
|
||||||
{
|
|
||||||
if(str.empty())
|
|
||||||
return "";
|
|
||||||
|
|
||||||
const char* start = str.c_str();
|
|
||||||
const char* cur = start + str.size() - 2;
|
|
||||||
|
|
||||||
while (cur >= start && *cur != '/')
|
|
||||||
--cur;
|
|
||||||
|
|
||||||
return cur + 1;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,31 +39,6 @@
|
||||||
#include "Windows.hxx"
|
#include "Windows.hxx"
|
||||||
#include "FSNodeWINDOWS.hxx"
|
#include "FSNodeWINDOWS.hxx"
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the last component of a given path.
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* c:\foo\bar.txt would return "\bar.txt"
|
|
||||||
* c:\foo\bar\ would return "\bar\"
|
|
||||||
*
|
|
||||||
* @param str Path to obtain the last component from.
|
|
||||||
* @return Pointer to the first char of the last component inside str.
|
|
||||||
*/
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
const char* lastPathComponent(const string& str)
|
|
||||||
{
|
|
||||||
if(str.empty())
|
|
||||||
return "";
|
|
||||||
|
|
||||||
const char* start = str.c_str();
|
|
||||||
const char* cur = start + str.size() - 2;
|
|
||||||
|
|
||||||
while(cur >= start && *cur != FilesystemNode::PATH_SEPARATOR)
|
|
||||||
--cur;
|
|
||||||
|
|
||||||
return cur + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool FilesystemNodeWINDOWS::exists() const
|
bool FilesystemNodeWINDOWS::exists() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue