1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-06 04:00:08 +00:00

New class StringPool. Removed the class var::identifier from its parent class, and renamed it "Identifier" - I've left a typedef in var to allow old code to still work, but I'll remove this at some point, so please switch to using the new classname directly. Jucer development.

This commit is contained in:
Julian Storer 2010-05-15 13:22:26 +01:00
parent ed97872c1a
commit b46e94cffd
90 changed files with 2839 additions and 1733 deletions

View file

@ -826,6 +826,39 @@ bool File::replaceWithText (const String& textToWrite,
return tempFile.overwriteTargetFileWithTemporary();
}
bool File::hasIdenticalContentTo (const File& other) const
{
if (other == *this)
return true;
if (getSize() == other.getSize() && existsAsFile() && other.existsAsFile())
{
FileInputStream in1 (*this), in2 (other);
const int bufferSize = 4096;
HeapBlock <char> buffer1, buffer2;
buffer1.malloc (bufferSize);
buffer2.malloc (bufferSize);
for (;;)
{
const int num1 = in1.read (buffer1, bufferSize);
const int num2 = in2.read (buffer2, bufferSize);
if (num1 != num2)
break;
if (num1 <= 0)
return true;
if (memcmp (buffer1, buffer2, num1) != 0)
break;
}
}
return false;
}
//==============================================================================
const String File::createLegalPathName (const String& original)
{

View file

@ -669,6 +669,11 @@ public:
bool asUnicode = false,
bool writeUnicodeHeaderBytes = false) const;
/** Attempts to scan the contents of this file and compare it to another file, returning
true if this is possible and they match byte-for-byte.
*/
bool hasIdenticalContentTo (const File& other) const;
//==============================================================================
/** Creates a set of files to represent each file root.