- updated

git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@117 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2015-01-05 13:35:46 +00:00
parent 3b38c6a587
commit 6e5aa7a991
156 changed files with 2332 additions and 1370 deletions
@@ -474,7 +474,11 @@ public:
numUsed += numberOfTimesToInsertIt;
while (--numberOfTimesToInsertIt >= 0)
new (insertPos++) ElementType (newElement);
{
new (insertPos) ElementType (newElement);
++insertPos; // NB: this increment is done separately from the
// new statement to avoid a compiler bug in VS2014
}
}
}
@@ -73,64 +73,71 @@ bool DirectoryIterator::next()
bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResult, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly)
{
hasBeenAdvanced = true;
if (subIterator != nullptr)
for (;;)
{
if (subIterator->next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly))
return true;
hasBeenAdvanced = true;
subIterator = nullptr;
}
String filename;
bool isDirectory, isHidden = false;
while (fileFinder.next (filename, &isDirectory,
(isHiddenResult != nullptr || (whatToLookFor & File::ignoreHiddenFiles) != 0) ? &isHidden : nullptr,
fileSize, modTime, creationTime, isReadOnly))
{
++index;
if (! filename.containsOnly ("."))
if (subIterator != nullptr)
{
bool matches = false;
if (isDirectory)
{
if (isRecursive && ((whatToLookFor & File::ignoreHiddenFiles) == 0 || ! isHidden))
subIterator = new DirectoryIterator (File::createFileWithoutCheckingPath (path + filename),
true, wildCard, whatToLookFor);
matches = (whatToLookFor & File::findDirectories) != 0;
}
else
{
matches = (whatToLookFor & File::findFiles) != 0;
}
// if we're not relying on the OS iterator to do the wildcard match, do it now..
if (matches && (isRecursive || wildCards.size() > 1))
matches = fileMatches (wildCards, filename);
if (matches && (whatToLookFor & File::ignoreHiddenFiles) != 0)
matches = ! isHidden;
if (matches)
{
currentFile = File::createFileWithoutCheckingPath (path + filename);
if (isHiddenResult != nullptr) *isHiddenResult = isHidden;
if (isDirResult != nullptr) *isDirResult = isDirectory;
if (subIterator->next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly))
return true;
}
if (subIterator != nullptr)
return next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly);
subIterator = nullptr;
}
}
return false;
String filename;
bool isDirectory, isHidden = false, shouldContinue = false;
while (fileFinder.next (filename, &isDirectory,
(isHiddenResult != nullptr || (whatToLookFor & File::ignoreHiddenFiles) != 0) ? &isHidden : nullptr,
fileSize, modTime, creationTime, isReadOnly))
{
++index;
if (! filename.containsOnly ("."))
{
bool matches = false;
if (isDirectory)
{
if (isRecursive && ((whatToLookFor & File::ignoreHiddenFiles) == 0 || ! isHidden))
subIterator = new DirectoryIterator (File::createFileWithoutCheckingPath (path + filename),
true, wildCard, whatToLookFor);
matches = (whatToLookFor & File::findDirectories) != 0;
}
else
{
matches = (whatToLookFor & File::findFiles) != 0;
}
// if we're not relying on the OS iterator to do the wildcard match, do it now..
if (matches && (isRecursive || wildCards.size() > 1))
matches = fileMatches (wildCards, filename);
if (matches && (whatToLookFor & File::ignoreHiddenFiles) != 0)
matches = ! isHidden;
if (matches)
{
currentFile = File::createFileWithoutCheckingPath (path + filename);
if (isHiddenResult != nullptr) *isHiddenResult = isHidden;
if (isDirResult != nullptr) *isDirResult = isDirectory;
return true;
}
if (subIterator != nullptr)
{
shouldContinue = true;
break;
}
}
}
if (! shouldContinue)
return false;
}
}
const File& DirectoryIterator::getFile() const
@@ -219,6 +219,11 @@ bool File::setReadOnly (const bool shouldBeReadOnly,
return setFileReadOnlyInternal (shouldBeReadOnly) && worked;
}
bool File::setExecutePermission (bool shouldBeExecutable) const
{
return setFileExecutableInternal (shouldBeExecutable);
}
bool File::deleteRecursively() const
{
bool worked = true;
@@ -348,6 +348,13 @@ public:
bool setReadOnly (bool shouldBeReadOnly,
bool applyRecursively = false) const;
/** Changes the execute-permissions of a file.
@param shouldBeExecutable whether to add or remove execute-permission
@returns true if it manages to change the file's permissions.
*/
bool setExecutePermission (bool shouldBeExecutable) const;
/** Returns true if this file is a hidden or system file.
The criteria for deciding whether a file is hidden are platform-dependent.
*/
@@ -968,6 +975,7 @@ private:
bool setFileTimesInternal (int64 m, int64 a, int64 c) const;
void getFileTimesInternal (int64& m, int64& a, int64& c) const;
bool setFileReadOnlyInternal (bool) const;
bool setFileExecutableInternal (bool) const;
};
#endif // JUCE_FILE_H_INCLUDED
@@ -1,7 +1,7 @@
{
"id": "juce_core",
"name": "JUCE core classes",
"version": "3.0.8",
"version": "3.1.1",
"description": "The essential set of basic JUCE classes, as required by all the other JUCE modules. Includes text, container, memory, threading and i/o functionality.",
"website": "http://www.juce.com/juce",
"license": "ISC Permissive",
@@ -32,7 +32,7 @@ FileLogger::FileLogger (const File& file,
: logFile (file)
{
if (maxInitialFileSizeBytes >= 0)
trimFileSize (maxInitialFileSizeBytes);
trimFileSize (logFile, maxInitialFileSizeBytes);
if (! file.exists())
file.create(); // (to create the parent directories)
@@ -57,23 +57,23 @@ void FileLogger::logMessage (const String& message)
out << message << newLine;
}
void FileLogger::trimFileSize (int64 maxFileSizeBytes) const
void FileLogger::trimFileSize (const File& file, int64 maxFileSizeBytes)
{
if (maxFileSizeBytes <= 0)
{
logFile.deleteFile();
file.deleteFile();
}
else
{
const int64 fileSize = logFile.getSize();
const int64 fileSize = file.getSize();
if (fileSize > maxFileSizeBytes)
{
TemporaryFile tempFile (logFile);
TemporaryFile tempFile (file);
{
FileOutputStream out (tempFile.getFile());
FileInputStream in (logFile);
FileInputStream in (file);
if (! (out.openedOk() && in.openedOk()))
return;
@@ -121,13 +121,17 @@ public:
// (implementation of the Logger virtual method)
void logMessage (const String&);
//==============================================================================
/** This is a utility function which removes lines from the start of a text
file to make sure that its total size is below the given size.
*/
static void trimFileSize (const File& file, int64 maxFileSize);
private:
//==============================================================================
File logFile;
CriticalSection logLock;
void trimFileSize (int64 maxFileSizeBytes) const;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileLogger)
};
@@ -1162,9 +1162,9 @@ double Expression::Scope::evaluateFunction (const String& functionName, const do
if (numParams == 1)
{
if (functionName == "sin") return sin (parameters[0]);
if (functionName == "cos") return cos (parameters[0]);
if (functionName == "tan") return tan (parameters[0]);
if (functionName == "sin") return std::sin (parameters[0]);
if (functionName == "cos") return std::cos (parameters[0]);
if (functionName == "tan") return std::tan (parameters[0]);
if (functionName == "abs") return std::abs (parameters[0]);
}
}
@@ -104,7 +104,7 @@ public:
ValueType proportion = (v - start) / (end - start);
if (skew != static_cast<ValueType> (1))
proportion = pow (proportion, skew);
proportion = std::pow (proportion, skew);
return proportion;
}
@@ -115,7 +115,7 @@ public:
ValueType convertFrom0to1 (ValueType proportion) const noexcept
{
if (skew != static_cast<ValueType> (1) && proportion > ValueType())
proportion = exp (log (proportion) / skew);
proportion = std::exp (std::log (proportion) / skew);
return start + (end - start) * proportion;
}
@@ -278,7 +278,7 @@ String SystemStats::getDisplayLanguage() { return getUserLanguage() + "-" + getU
//==============================================================================
void CPUInformation::initialise() noexcept
{
numCpus = jmax (1, sysconf (_SC_NPROCESSORS_ONLN));
numCpus = jmax (1, (int) sysconf (_SC_NPROCESSORS_ONLN));
}
//==============================================================================
@@ -32,17 +32,21 @@ String String::fromCFString (CFStringRef cfString)
return String();
CFRange range = { 0, CFStringGetLength (cfString) };
HeapBlock <UniChar> u ((size_t) range.length + 1);
CFStringGetCharacters (cfString, range, u);
u[range.length] = 0;
CFIndex bytesNeeded = 0;
CFStringGetBytes (cfString, range, kCFStringEncodingUTF8, 0, false, nullptr, 0, &bytesNeeded);
return String (CharPointer_UTF16 ((const CharPointer_UTF16::CharType*) u.getData()));
HeapBlock<UInt8> utf8 ((size_t) bytesNeeded + 1);
CFStringGetBytes (cfString, range, kCFStringEncodingUTF8, 0, false, utf8, bytesNeeded + 1, nullptr);
return String (CharPointer_UTF8 ((const CharPointer_UTF8::CharType*) utf8.getData()),
CharPointer_UTF8 ((const CharPointer_UTF8::CharType*) utf8.getData() + bytesNeeded));
}
CFStringRef String::toCFString() const
{
CharPointer_UTF16 utf16 (toUTF16());
return CFStringCreateWithCharacters (kCFAllocatorDefault, (const UniChar*) utf16.getAddress(), (CFIndex) utf16.length());
const char* const utf8 = toRawUTF8();
return CFStringCreateWithBytes (kCFAllocatorDefault, (const UInt8*) utf8,
(CFIndex) strlen (utf8), kCFStringEncodingUTF8, false);
}
String String::convertToPrecomposedUnicode() const
@@ -72,7 +76,7 @@ String String::convertToPrecomposedUnicode() const
{
const size_t bytesNeeded = CharPointer_UTF16::getBytesRequiredFor (getCharPointer());
HeapBlock <char> tempOut;
HeapBlock<char> tempOut;
tempOut.calloc (bytesNeeded + 4);
ByteCount bytesRead = 0;
@@ -304,23 +304,33 @@ bool File::hasWriteAccess() const
return false;
}
bool File::setFileReadOnlyInternal (const bool shouldBeReadOnly) const
static bool setFileModeFlags (const String& fullPath, mode_t flags, bool shouldSet) noexcept
{
juce_statStruct info;
if (! juce_stat (fullPath, info))
return false;
info.st_mode &= 0777; // Just permissions
info.st_mode &= 0777;
if (shouldBeReadOnly)
info.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
if (shouldSet)
info.st_mode |= flags;
else
// Give everybody write permission?
info.st_mode |= S_IWUSR | S_IWGRP | S_IWOTH;
info.st_mode &= ~flags;
return chmod (fullPath.toUTF8(), info.st_mode) == 0;
}
bool File::setFileReadOnlyInternal (bool shouldBeReadOnly) const
{
// Hmm.. should we give global write permission or just the current user?
return setFileModeFlags (fullPath, S_IWUSR | S_IWGRP | S_IWOTH, ! shouldBeReadOnly);
}
bool File::setFileExecutableInternal (bool shouldBeExecutable) const
{
return setFileModeFlags (fullPath, S_IXUSR | S_IXGRP | S_IXOTH, shouldBeExecutable);
}
void File::getFileTimesInternal (int64& modificationTime, int64& accessTime, int64& creationTime) const
{
modificationTime = 0;
@@ -328,11 +338,12 @@ void File::getFileTimesInternal (int64& modificationTime, int64& accessTime, int
creationTime = 0;
juce_statStruct info;
if (juce_stat (fullPath, info))
{
modificationTime = (int64) info.st_mtime * 1000;
accessTime = (int64) info.st_atime * 1000;
creationTime = (int64) info.st_ctime * 1000;
modificationTime = (int64) info.st_mtime * 1000;
accessTime = (int64) info.st_atime * 1000;
creationTime = (int64) info.st_ctime * 1000;
}
}
@@ -163,6 +163,12 @@ bool File::setFileReadOnlyInternal (const bool shouldBeReadOnly) const
|| SetFileAttributes (fullPath.toWideCharPointer(), newAtts) != FALSE;
}
bool File::setFileExecutableInternal (bool /*shouldBeExecutable*/) const
{
// XXX is this possible?
return false;
}
bool File::isHidden() const
{
return (WindowsFileHelpers::getAtts (fullPath) & FILE_ATTRIBUTE_HIDDEN) != 0;
@@ -389,7 +389,10 @@ void StreamingSocket::close()
}
if (handle != -1)
{
::shutdown (handle, SHUT_RDWR);
::close (handle);
}
#endif
hostName.clear();
@@ -397,6 +397,17 @@ URL URL::withParameter (const String& parameterName,
return u;
}
URL URL::withParameters (const StringPairArray& parametersToAdd) const
{
URL u (*this);
for (int i = 0; i < parametersToAdd.size(); ++i)
u.addParameter (parametersToAdd.getAllKeys()[i],
parametersToAdd.getAllValues()[i]);
return u;
}
URL URL::withPOSTData (const String& newPostData) const
{
URL u (*this);
@@ -482,8 +493,8 @@ String URL::addEscapeChars (const String& s, const bool isParameter)
|| legalChars.indexOf ((juce_wchar) c) >= 0))
{
utf8.set (i, '%');
utf8.insert (++i, "0123456789abcdef" [((uint8) c) >> 4]);
utf8.insert (++i, "0123456789abcdef" [c & 15]);
utf8.insert (++i, "0123456789ABCDEF" [((uint8) c) >> 4]);
utf8.insert (++i, "0123456789ABCDEF" [c & 15]);
}
}
@@ -140,6 +140,12 @@ public:
URL withParameter (const String& parameterName,
const String& parameterValue) const;
/** Returns a copy of this URL, with a set of GET or POST parameters added.
This is a convenience method, equivalent to calling withParameter for each value.
@see withParameter
*/
URL withParameters (const StringPairArray& parametersToAdd) const;
/** Returns a copy of this URL, with a file-upload type parameter added to it.
When performing a POST where one of your parameters is a binary file, this
@@ -35,8 +35,8 @@
See also SystemStats::getJUCEVersion() for a string version.
*/
#define JUCE_MAJOR_VERSION 3
#define JUCE_MINOR_VERSION 0
#define JUCE_BUILDNUMBER 8
#define JUCE_MINOR_VERSION 1
#define JUCE_BUILDNUMBER 1
/** Current Juce version number.
@@ -47,28 +47,29 @@ public:
/** The set of possible results of the getOperatingSystemType() method. */
enum OperatingSystemType
{
UnknownOS = 0,
UnknownOS = 0,
Linux = 0x2000,
Android = 0x3000,
iOS = 0x8000,
Linux = 0x2000,
Android = 0x3000,
iOS = 0x8000,
MacOSX_10_4 = 0x1004,
MacOSX_10_5 = 0x1005,
MacOSX_10_6 = 0x1006,
MacOSX_10_7 = 0x1007,
MacOSX_10_8 = 0x1008,
MacOSX_10_9 = 0x1009,
MacOSX_10_4 = 0x1004,
MacOSX_10_5 = 0x1005,
MacOSX_10_6 = 0x1006,
MacOSX_10_7 = 0x1007,
MacOSX_10_8 = 0x1008,
MacOSX_10_9 = 0x1009,
MacOSX_10_10 = 0x100a,
Win2000 = 0x4105,
WinXP = 0x4106,
WinVista = 0x4107,
Windows7 = 0x4108,
Windows8_0 = 0x4109,
Windows8_1 = 0x410a,
Win2000 = 0x4105,
WinXP = 0x4106,
WinVista = 0x4107,
Windows7 = 0x4108,
Windows8_0 = 0x4109,
Windows8_1 = 0x410a,
Windows = 0x4000, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */
Windows = 0x4000, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */
};
/** Returns the type of operating system we're running on.
@@ -41,7 +41,7 @@
@code
XmlDocument myDocument (File ("myfile.xml"));
XmlElement* mainElement = myDocument.getDocumentElement();
ScopedPointer<XmlElement> mainElement (myDocument.getDocumentElement());
if (mainElement == nullptr)
{
@@ -57,7 +57,7 @@
Or you can use the static helper methods for quick parsing..
@code
XmlElement* xml = XmlDocument::parse (myXmlFile);
ScopedPointer<XmlElement> xml (XmlDocument::parse (myXmlFile));
if (xml != nullptr && xml->hasTagName ("foobar"))
{