Changed internal naming convention (local variables now start with a lower case character)

Removed the AudioResource class

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1166 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-07-11 22:17:24 +00:00
parent 7cc00085d8
commit 45b150648d
245 changed files with 7865 additions and 8065 deletions

View file

@ -46,10 +46,10 @@ public :
////////////////////////////////////////////////////////////
/// Construct the lock with a target mutex (lock it)
///
/// @param Mutex : Mutex to lock
/// \param mutex : Mutex to lock
///
////////////////////////////////////////////////////////////
Lock(Mutex& Mutex);
Lock(Mutex& mutex);
////////////////////////////////////////////////////////////
/// Destructor (unlocks the mutex)

View file

@ -45,10 +45,10 @@ public :
/// Set the seed for the generator. Using a known seed
/// allows you to reproduce the same sequence of random number
///
/// \param Seed : Number to use as the seed
/// \param seed : Number to use as the seed
///
////////////////////////////////////////////////////////////
static void SetSeed(unsigned int Seed);
static void SetSeed(unsigned int seed);
////////////////////////////////////////////////////////////
/// Get the seed used to generate random numbers the generator.
@ -61,24 +61,24 @@ public :
////////////////////////////////////////////////////////////
/// Get a random float number in a given range
///
/// \return Start : Start of the range
/// \return End : End of the range
/// \return begin : Beginning of the range
/// \return end : End of the range
///
/// \return Random number in [Begin, End]
/// \return Random number in [begin, end]
///
////////////////////////////////////////////////////////////
static float Random(float Begin, float End);
static float Random(float begin, float end);
////////////////////////////////////////////////////////////
/// Get a random integer number in a given range
///
/// \return Start : Start of the range
/// \return End : End of the range
/// \return begin : Beginning of the range
/// \return end : End of the range
///
/// \return Random number in [Begin, End]
/// \return Random number in [begin, end]
///
////////////////////////////////////////////////////////////
static int Random(int Begin, int End);
static int Random(int begin, int end);
};
} // namespace sf

View file

@ -60,10 +60,10 @@ protected :
////////////////////////////////////////////////////////////
/// Copy constructor
///
/// \param Copy : Resource to copy
/// \param copy : Resource to copy
///
////////////////////////////////////////////////////////////
Resource(const Resource<T>& Copy);
Resource(const Resource<T>& copy);
////////////////////////////////////////////////////////////
/// Destructor
@ -74,12 +74,12 @@ protected :
////////////////////////////////////////////////////////////
/// Assignment operator
///
/// \param Other : Resource to copy
/// \param other : Resource to copy
///
/// \return Reference to this
///
////////////////////////////////////////////////////////////
Resource<T>& operator =(const Resource<T>& Other);
Resource<T>& operator =(const Resource<T>& other);
private :
@ -88,18 +88,18 @@ private :
////////////////////////////////////////////////////////////
/// Connect a ResourcePtr to this resource
///
/// \param Observer : Observer to add
/// \param observer : Observer to add
///
////////////////////////////////////////////////////////////
void Connect(ResourcePtr<T>& Observer) const;
void Connect(ResourcePtr<T>& observer) const;
////////////////////////////////////////////////////////////
/// Disconnect a ResourcePtr from this resource
///
/// \param Observer : Observer to remove
/// \param observer : Observer to remove
///
////////////////////////////////////////////////////////////
void Disconnect(ResourcePtr<T>& Observer) const;
void Disconnect(ResourcePtr<T>& observer) const;
////////////////////////////////////////////////////////////
// Member data
@ -126,18 +126,18 @@ public :
////////////////////////////////////////////////////////////
/// Construct from a raw resource
///
/// \param Resource : Internal resource
/// \param resource : Internal resource
///
////////////////////////////////////////////////////////////
ResourcePtr(const T* Resource);
ResourcePtr(const T* resource);
////////////////////////////////////////////////////////////
/// Copy constructor
///
/// \param Copy : Instance to copy
/// \param copy : Instance to copy
///
////////////////////////////////////////////////////////////
ResourcePtr(const ResourcePtr<T>& Copy);
ResourcePtr(const ResourcePtr<T>& copy);
////////////////////////////////////////////////////////////
/// Destructor
@ -148,22 +148,22 @@ public :
////////////////////////////////////////////////////////////
/// Assignment operator from another ResourcePtr
///
/// \param Other : Resource pointer to assign
/// \param other : Resource pointer to assign
///
/// \return Reference to this
///
////////////////////////////////////////////////////////////
ResourcePtr<T>& operator =(const ResourcePtr<T>& Other);
ResourcePtr<T>& operator =(const ResourcePtr<T>& other);
////////////////////////////////////////////////////////////
/// Assignment operator from a raw resource
///
/// \param Resource : Resource to assign
/// \param resource : Resource to assign
///
/// \return Reference to this
///
////////////////////////////////////////////////////////////
ResourcePtr<T>& operator =(const T* Resource);
ResourcePtr<T>& operator =(const T* resource);
////////////////////////////////////////////////////////////
/// Cast operator to implicitely convert the resource pointer to

View file

@ -72,9 +72,9 @@ Resource<T>& Resource<T>::operator =(const Resource<T>&)
/// Connect a ResourcePtr to this resource
////////////////////////////////////////////////////////////
template <typename T>
void Resource<T>::Connect(ResourcePtr<T>& Observer) const
void Resource<T>::Connect(ResourcePtr<T>& observer) const
{
myObservers.insert(&Observer);
myObservers.insert(&observer);
}
@ -82,7 +82,7 @@ void Resource<T>::Connect(ResourcePtr<T>& Observer) const
/// Disconnect a ResourcePtr from this resource
////////////////////////////////////////////////////////////
template <typename T>
void Resource<T>::Disconnect(ResourcePtr<T>& Observer) const
void Resource<T>::Disconnect(ResourcePtr<T>& observer) const
{
myObservers.erase(&Observer);
myObservers.erase(&observer);
}

View file

@ -38,8 +38,8 @@ myResource(NULL)
/// Construct from a raw resource
////////////////////////////////////////////////////////////
template <typename T>
ResourcePtr<T>::ResourcePtr(const T* Resource) :
myResource(Resource)
ResourcePtr<T>::ResourcePtr(const T* resource) :
myResource(resource)
{
if (myResource)
myResource->Connect(*this);
@ -50,8 +50,8 @@ myResource(Resource)
/// Copy constructor
////////////////////////////////////////////////////////////
template <typename T>
ResourcePtr<T>::ResourcePtr(const ResourcePtr<T>& Copy) :
myResource(Copy.myResource)
ResourcePtr<T>::ResourcePtr(const ResourcePtr<T>& copy) :
myResource(copy.myResource)
{
if (myResource)
myResource->Connect(*this);
@ -73,12 +73,12 @@ ResourcePtr<T>::~ResourcePtr()
/// Assignment operator from another ResourcePtr
////////////////////////////////////////////////////////////
template <typename T>
ResourcePtr<T>& ResourcePtr<T>::operator =(const ResourcePtr<T>& Other)
ResourcePtr<T>& ResourcePtr<T>::operator =(const ResourcePtr<T>& other)
{
if (myResource)
myResource->Disconnect(*this);
myResource = Other.myResource;
myResource = other.myResource;
if (myResource)
myResource->Connect(*this);
@ -91,12 +91,12 @@ ResourcePtr<T>& ResourcePtr<T>::operator =(const ResourcePtr<T>& Other)
/// Assignment operator from a raw resource
////////////////////////////////////////////////////////////
template <typename T>
ResourcePtr<T>& ResourcePtr<T>::operator =(const T* Resource)
ResourcePtr<T>& ResourcePtr<T>::operator =(const T* resource)
{
if (myResource)
myResource->Disconnect(*this);
myResource = Resource;
myResource = resource;
if (myResource)
myResource->Connect(*this);

View file

@ -36,10 +36,10 @@ namespace sf
////////////////////////////////////////////////////////////
/// Make the current thread sleep for a given time
///
/// \param Duration : Time to sleep, in seconds (must be >= 0)
/// \param duration : Time to sleep, in seconds (must be >= 0)
///
////////////////////////////////////////////////////////////
void SFML_API Sleep(float Duration);
void SFML_API Sleep(float duration);
} // namespace sf

View file

@ -56,11 +56,11 @@ public :
////////////////////////////////////////////////////////////
/// Construct the thread from a function pointer
///
/// \param Function : Entry point of the thread
/// \param UserData : Data to pass to the thread function (NULL by default)
/// \param function : Entry point of the thread
/// \param userData : Data to pass to the thread function (NULL by default)
///
////////////////////////////////////////////////////////////
Thread(FuncType Function, void* UserData = NULL);
Thread(FuncType function, void* userData = NULL);
////////////////////////////////////////////////////////////
/// Virtual destructor

View file

@ -54,10 +54,10 @@ public :
////////////////////////////////////////////////////////////
/// Default constructor
///
/// \param Value : Optional value to initalize the variable (NULL by default)
/// \param value : Optional value to initalize the variable (NULL by default)
///
////////////////////////////////////////////////////////////
ThreadLocal(void* Value = NULL);
ThreadLocal(void* value = NULL);
////////////////////////////////////////////////////////////
/// Destructor
@ -71,7 +71,7 @@ public :
/// \param Value : Value of the variable for this thread
///
////////////////////////////////////////////////////////////
void SetValue(void* Value);
void SetValue(void* value);
////////////////////////////////////////////////////////////
/// Retrieve the thread-specific value of the variable

View file

@ -44,10 +44,10 @@ public :
////////////////////////////////////////////////////////////
/// Default constructor
///
/// \param Value : Optional value to initalize the variable (NULL by default)
/// \param value : Optional value to initalize the variable (NULL by default)
///
////////////////////////////////////////////////////////////
ThreadLocalPtr(T* Value = NULL);
ThreadLocalPtr(T* value = NULL);
////////////////////////////////////////////////////////////
/// Operator * overload to return a reference to the variable
@ -76,22 +76,22 @@ public :
////////////////////////////////////////////////////////////
/// Assignment operator
///
/// \param Value : New pointer value to assign for this thread
/// \param value : New pointer value to assign for this thread
///
/// \return Reference to this
///
////////////////////////////////////////////////////////////
ThreadLocalPtr<T>& operator =(T* Value);
ThreadLocalPtr<T>& operator =(T* value);
////////////////////////////////////////////////////////////
/// Assignment operator
///
/// \param Other : Other thread-local pointer value to assign
/// \param other : Other thread-local pointer value to assign
///
/// \return Reference to this
///
////////////////////////////////////////////////////////////
ThreadLocalPtr<T>& operator =(const ThreadLocalPtr<T>& Other);
ThreadLocalPtr<T>& operator =(const ThreadLocalPtr<T>& other);
};
} // namespace sf

View file

@ -73,19 +73,19 @@ public :
////////////////////////////////////////////////////////////
/// Construct the unicode text from any type of string
///
/// \param Str : String to convert
/// \param str : String to convert
///
////////////////////////////////////////////////////////////
Text(const char* Str);
Text(const wchar_t* Str);
Text(const Uint8* Str);
Text(const Uint16* Str);
Text(const Uint32* Str);
Text(const std::string& Str);
Text(const std::wstring& Str);
Text(const Unicode::UTF8String& Str);
Text(const Unicode::UTF16String& Str);
Text(const Unicode::UTF32String& Str);
Text(const char* str);
Text(const wchar_t* str);
Text(const Uint8* str);
Text(const Uint16* str);
Text(const Uint32* str);
Text(const std::string& str);
Text(const std::wstring& str);
Text(const Unicode::UTF8String& str);
Text(const Unicode::UTF16String& str);
Text(const Unicode::UTF32String& str);
////////////////////////////////////////////////////////////
/// Operator to cast the text to any type of string
@ -111,158 +111,158 @@ public :
/// Generic function to convert an UTF-32 characters range
/// to an ANSI characters range, using the given locale
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param Output : Iterator pointing to the beginning of the output sequence
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
/// \param Locale : Locale to use for conversion (uses the current one by default)
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
/// \param output : Iterator pointing to the beginning of the output sequence
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
/// \param locale : Locale to use for conversion (uses the current one by default)
///
/// \return Iterator to the end of the output sequence which has been written
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out UTF32ToANSI(In Begin, In End, Out Output, char Replacement = '?', const std::locale& Locale = GetDefaultLocale());
static Out UTF32ToANSI(In begin, In end, Out output, char replacement = '?', const std::locale& locale = GetDefaultLocale());
////////////////////////////////////////////////////////////
/// Generic function to convert an ANSI characters range
/// to an UTF-32 characters range, using the given locale
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param Output : Iterator pointing to the beginning of the output sequence
/// \param Locale : Locale to use for conversion (uses the current one by default)
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
/// \param output : Iterator pointing to the beginning of the output sequence
/// \param locale : Locale to use for conversion (uses the current one by default)
///
/// \return Iterator to the end of the output sequence which has been written
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ANSIToUTF32(In Begin, In End, Out Output, const std::locale& Locale = GetDefaultLocale());
static Out ANSIToUTF32(In begin, In end, Out output, const std::locale& locale = GetDefaultLocale());
////////////////////////////////////////////////////////////
/// Generic function to convert an UTF-8 characters range
/// to an UTF-16 characters range, using the given locale
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param Output : Iterator pointing to the beginning of the output sequence
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
/// \param output : Iterator pointing to the beginning of the output sequence
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
///
/// \return Iterator to the end of the output sequence which has been written
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement = '?');
static Out UTF8ToUTF16(In begin, In end, Out output, Uint16 replacement = '?');
////////////////////////////////////////////////////////////
/// Generic function to convert an UTF-8 characters range
/// to an UTF-32 characters range, using the given locale
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param Output : Iterator pointing to the beginning of the output sequence
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
/// \param output : Iterator pointing to the beginning of the output sequence
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
///
/// \return Iterator to the end of the output sequence which has been written
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement = '?');
static Out UTF8ToUTF32(In begin, In end, Out output, Uint32 replacement = '?');
////////////////////////////////////////////////////////////
/// Generic function to convert an UTF-16 characters range
/// to an UTF-8 characters range, using the given locale
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param Output : Iterator pointing to the beginning of the output sequence
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
/// \param output : Iterator pointing to the beginning of the output sequence
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
///
/// \return Iterator to the end of the output sequence which has been written
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement = '?');
static Out UTF16ToUTF8(In begin, In end, Out output, Uint8 replacement = '?');
////////////////////////////////////////////////////////////
/// Generic function to convert an UTF-16 characters range
/// to an UTF-32 characters range, using the given locale
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param Output : Iterator pointing to the beginning of the output sequence
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
/// \param output : Iterator pointing to the beginning of the output sequence
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
///
/// \return Iterator to the end of the output sequence which has been written
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacement = '?');
static Out UTF16ToUTF32(In begin, In end, Out output, Uint32 replacement = '?');
////////////////////////////////////////////////////////////
/// Generic function to convert an UTF-32 characters range
/// to an UTF-8 characters range, using the given locale
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param Output : Iterator pointing to the beginning of the output sequence
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
/// \param output : Iterator pointing to the beginning of the output sequence
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
///
/// \return Iterator to the end of the output sequence which has been written
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement = '?');
static Out UTF32ToUTF8(In begin, In end, Out output, Uint8 replacement = '?');
////////////////////////////////////////////////////////////
/// Generic function to convert an UTF-32 characters range
/// to an UTF-16 characters range, using the given locale
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param Output : Iterator pointing to the beginning of the output sequence
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
/// \param output : Iterator pointing to the beginning of the output sequence
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
///
/// \return Iterator to the end of the output sequence which has been written
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacement = '?');
static Out UTF32ToUTF16(In begin, In end, Out output, Uint16 replacement = '?');
////////////////////////////////////////////////////////////
/// Get the number of characters composing an UTF-8 string
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
///
/// \return Count of the characters in the string
///
////////////////////////////////////////////////////////////
template <typename In>
static std::size_t GetUTF8Length(In Begin, In End);
static std::size_t GetUTF8Length(In begin, In end);
////////////////////////////////////////////////////////////
/// Get the number of characters composing an UTF-16 string
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
///
/// \return Count of the characters in the string
///
////////////////////////////////////////////////////////////
template <typename In>
static std::size_t GetUTF16Length(In Begin, In End);
static std::size_t GetUTF16Length(In begin, In end);
////////////////////////////////////////////////////////////
/// Get the number of characters composing an UTF-32 string
///
/// \param Begin : Iterator pointing to the beginning of the input sequence
/// \param End : Iterator pointing to the end of the input sequence
/// \param begin : Iterator pointing to the beginning of the input sequence
/// \param end : Iterator pointing to the end of the input sequence
///
/// \return Count of the characters in the string
///
////////////////////////////////////////////////////////////
template <typename In>
static std::size_t GetUTF32Length(In Begin, In End);
static std::size_t GetUTF32Length(In begin, In end);
private :

View file

@ -28,34 +28,34 @@
/// to an ANSI characters range, using the given locale
////////////////////////////////////////////////////////////
template <typename In, typename Out>
inline Out Unicode::UTF32ToANSI(In Begin, In End, Out Output, char Replacement, const std::locale& Locale)
inline Out Unicode::UTF32ToANSI(In begin, In end, Out output, char replacement, const std::locale& locale)
{
#ifdef __MINGW32__
// MinGW has a almost no support for unicode stuff
// As a consequence, the MinGW version of this function can only use the default locale
// and ignores the one passed as parameter
while (Begin < End)
while (begin < end)
{
char Char = 0;
if (wctomb(&Char, static_cast<wchar_t>(*Begin++)) >= 0)
*Output++ = Char;
else if (Replacement)
*Output++ = Replacement;
char character = 0;
if (wctomb(&character, static_cast<wchar_t>(*begin++)) >= 0)
*output++ = character;
else if (replacement)
*output++ = replacement;
}
#else
// Get the facet of the locale which deals with character conversion
const std::ctype<wchar_t>& Facet = std::use_facet< std::ctype<wchar_t> >(Locale);
const std::ctype<wchar_t>& facet = std::use_facet< std::ctype<wchar_t> >(locale);
// Use the facet to convert each character of the input string
while (Begin < End)
*Output++ = Facet.narrow(static_cast<wchar_t>(*Begin++), Replacement);
while (begin < end)
*output++ = facet.narrow(static_cast<wchar_t>(*begin++), replacement);
#endif
return Output;
return output;
}
@ -64,33 +64,33 @@ inline Out Unicode::UTF32ToANSI(In Begin, In End, Out Output, char Replacement,
/// to an UTF-32 characters range, using the given locale
////////////////////////////////////////////////////////////
template <typename In, typename Out>
inline Out Unicode::ANSIToUTF32(In Begin, In End, Out Output, const std::locale& Locale)
inline Out Unicode::ANSIToUTF32(In begin, In end, Out output, const std::locale& locale)
{
#ifdef __MINGW32__
// MinGW has a almost no support for unicode stuff
// As a consequence, the MinGW version of this function can only use the default locale
// and ignores the one passed as parameter
while (Begin < End)
while (begin < end)
{
wchar_t Char = 0;
mbtowc(&Char, &*Begin, 1);
wchar_t character = 0;
mbtowc(&character, &*begin, 1);
Begin++;
*Output++ = static_cast<Uint32>(Char);
*output++ = static_cast<Uint32>(character);
}
#else
// Get the facet of the locale which deals with character conversion
const std::ctype<wchar_t>& Facet = std::use_facet< std::ctype<wchar_t> >(Locale);
const std::ctype<wchar_t>& facet = std::use_facet< std::ctype<wchar_t> >(locale);
// Use the facet to convert each character of the input string
while (Begin < End)
*Output++ = static_cast<Uint32>(Facet.widen(*Begin++));
while (begin < end)
*output++ = static_cast<Uint32>(facet.widen(*begin++));
#endif
return Output;
return output;
}
@ -99,59 +99,59 @@ inline Out Unicode::ANSIToUTF32(In Begin, In End, Out Output, const std::locale&
/// to an UTF-16 characters range, using the given locale
////////////////////////////////////////////////////////////
template <typename In, typename Out>
inline Out Unicode::UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement)
inline Out Unicode::UTF8ToUTF16(In begin, In end, Out output, Uint16 replacement)
{
while (Begin < End)
while (begin < end)
{
Uint32 c = 0;
int TrailingBytes = UTF8TrailingBytes[static_cast<int>(*Begin)];
if (Begin + TrailingBytes < End)
Uint32 character = 0;
int trailingBytes = UTF8TrailingBytes[static_cast<int>(*begin)];
if (begin + trailingBytes < end)
{
// First decode the UTF-8 character
switch (TrailingBytes)
switch (trailingBytes)
{
case 5 : c += *Begin++; c <<= 6;
case 4 : c += *Begin++; c <<= 6;
case 3 : c += *Begin++; c <<= 6;
case 2 : c += *Begin++; c <<= 6;
case 1 : c += *Begin++; c <<= 6;
case 0 : c += *Begin++;
case 5 : character += *begin++; character <<= 6;
case 4 : character += *begin++; character <<= 6;
case 3 : character += *begin++; character <<= 6;
case 2 : character += *begin++; character <<= 6;
case 1 : character += *begin++; character <<= 6;
case 0 : character += *begin++;
}
c -= UTF8Offsets[TrailingBytes];
character -= UTF8Offsets[trailingBytes];
// Then encode it in UTF-16
if (c < 0xFFFF)
if (character < 0xFFFF)
{
// Character can be converted directly to 16 bits, just need to check it's in the valid range
if ((c >= 0xD800) && (c <= 0xDFFF))
if ((character >= 0xD800) && (character <= 0xDFFF))
{
// Invalid character (this range is reserved)
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
else
{
// Valid character directly convertible to 16 bits
*Output++ = static_cast<Uint16>(c);
*Output++ = static_cast<Uint16>(character);
}
}
else if (c > 0x0010FFFF)
else if (character > 0x0010FFFF)
{
// Invalid character (greater than the maximum unicode value)
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
else
{
// Character will be converted to 2 UTF-16 elements
c -= 0x0010000;
*Output++ = static_cast<Uint16>((c >> 10) + 0xD800);
*Output++ = static_cast<Uint16>((c & 0x3FFUL) + 0xDC00);
character -= 0x0010000;
*output++ = static_cast<Uint16>((character >> 10) + 0xD800);
*output++ = static_cast<Uint16>((character & 0x3FFUL) + 0xDC00);
}
}
}
return Output;
return output;
}
@ -160,42 +160,42 @@ inline Out Unicode::UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement
/// to an UTF-32 characters range, using the given locale
////////////////////////////////////////////////////////////
template <typename In, typename Out>
inline Out Unicode::UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement)
inline Out Unicode::UTF8ToUTF32(In begin, In end, Out output, Uint32 replacement)
{
while (Begin < End)
while (begin < end)
{
Uint32 c = 0;
int TrailingBytes = UTF8TrailingBytes[static_cast<int>(*Begin)];
if (Begin + TrailingBytes < End)
Uint32 character = 0;
int trailingBytes = UTF8TrailingBytes[static_cast<int>(*begin)];
if (begin + trailingBytes < end)
{
// First decode the UTF-8 character
switch (TrailingBytes)
switch (trailingBytes)
{
case 5 : c += *Begin++; c <<= 6;
case 4 : c += *Begin++; c <<= 6;
case 3 : c += *Begin++; c <<= 6;
case 2 : c += *Begin++; c <<= 6;
case 1 : c += *Begin++; c <<= 6;
case 0 : c += *Begin++;
case 5 : character += *begin++; character <<= 6;
case 4 : character += *begin++; character <<= 6;
case 3 : character += *begin++; character <<= 6;
case 2 : character += *begin++; character <<= 6;
case 1 : character += *begin++; character <<= 6;
case 0 : character += *begin++;
}
c -= UTF8Offsets[TrailingBytes];
character -= UTF8Offsets[trailingBytes];
// Then write it if valid
if ((c < 0xD800) || (c > 0xDFFF))
if ((character < 0xD800) || (character > 0xDFFF))
{
// Valid UTF-32 character
*Output++ = c;
*output++ = character;
}
else
{
// Invalid UTF-32 character
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
}
}
return Output;
return output;
}
@ -204,71 +204,71 @@ inline Out Unicode::UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement
/// to an UTF-8 characters range, using the given locale
////////////////////////////////////////////////////////////
template <typename In, typename Out>
inline Out Unicode::UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement)
inline Out Unicode::UTF16ToUTF8(In begin, In end, Out output, Uint8 replacement)
{
while (Begin < End)
while (begin < end)
{
Uint32 c = *Begin++;
Uint32 character = *begin++;
// If it's a surrogate pair, first convert to a single UTF-32 character
if ((c >= 0xD800) && (c <= 0xDBFF))
if ((character >= 0xD800) && (character <= 0xDBFF))
{
if (Begin < End)
if (begin < end)
{
// The second element is valid : convert the two elements to a UTF-32 character
Uint32 d = *Begin++;
Uint32 d = *begin++;
if ((d >= 0xDC00) && (d <= 0xDFFF))
c = static_cast<Uint32>(((c - 0xD800) << 10) + (d - 0xDC00) + 0x0010000);
character = static_cast<Uint32>(((character - 0xD800) << 10) + (d - 0xDC00) + 0x0010000);
}
else
{
// Invalid second element
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
}
// Then convert to UTF-8
if (c > 0x0010FFFF)
if (character > 0x0010FFFF)
{
// Invalid character (greater than the maximum unicode value)
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
else
{
// Valid character
// Get number of bytes to write
int BytesToWrite = 1;
if (c < 0x80) BytesToWrite = 1;
else if (c < 0x800) BytesToWrite = 2;
else if (c < 0x10000) BytesToWrite = 3;
else if (c <= 0x0010FFFF) BytesToWrite = 4;
int bytesToWrite = 1;
if (character < 0x80) bytesToWrite = 1;
else if (character < 0x800) bytesToWrite = 2;
else if (character < 0x10000) bytesToWrite = 3;
else if (character <= 0x0010FFFF) bytesToWrite = 4;
// Extract bytes to write
Uint8 Bytes[4];
switch (BytesToWrite)
Uint8 bytes[4];
switch (bytesToWrite)
{
case 4 : Bytes[3] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
case 3 : Bytes[2] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
case 2 : Bytes[1] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
case 1 : Bytes[0] = static_cast<Uint8> (c | UTF8FirstBytes[BytesToWrite]);
case 4 : bytes[3] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
case 3 : bytes[2] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
case 2 : bytes[1] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
case 1 : bytes[0] = static_cast<Uint8> (character | UTF8FirstBytes[bytesToWrite]);
}
// Add them to the output
const Uint8* CurByte = Bytes;
switch (BytesToWrite)
const Uint8* currentByte = bytes;
switch (bytesToWrite)
{
case 4 : *Output++ = *CurByte++;
case 3 : *Output++ = *CurByte++;
case 2 : *Output++ = *CurByte++;
case 1 : *Output++ = *CurByte++;
case 4 : *output++ = *currentByte++;
case 3 : *output++ = *currentByte++;
case 2 : *output++ = *currentByte++;
case 1 : *output++ = *currentByte++;
}
}
}
return Output;
return output;
}
@ -277,44 +277,44 @@ inline Out Unicode::UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement)
/// to an UTF-32 characters range, using the given locale
////////////////////////////////////////////////////////////
template <typename In, typename Out>
inline Out Unicode::UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacement)
inline Out Unicode::UTF16ToUTF32(In begin, In end, Out output, Uint32 replacement)
{
while (Begin < End)
while (begin < end)
{
Uint16 c = *Begin++;
if ((c >= 0xD800) && (c <= 0xDBFF))
Uint16 character = *begin++;
if ((character >= 0xD800) && (character <= 0xDBFF))
{
// We have a surrogate pair, ie. a character composed of two elements
if (Begin < End)
if (begin < end)
{
Uint16 d = *Begin++;
Uint16 d = *begin++;
if ((d >= 0xDC00) && (d <= 0xDFFF))
{
// The second element is valid : convert the two elements to a UTF-32 character
*Output++ = static_cast<Uint32>(((c - 0xD800) << 10) + (d - 0xDC00) + 0x0010000);
*output++ = static_cast<Uint32>(((character - 0xD800) << 10) + (d - 0xDC00) + 0x0010000);
}
else
{
// Invalid second element
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
}
}
else if ((c >= 0xDC00) && (c <= 0xDFFF))
else if ((character >= 0xDC00) && (character <= 0xDFFF))
{
// Invalid character
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
else
{
// Valid character directly convertible to UTF-32
*Output++ = static_cast<Uint32>(c);
*output++ = static_cast<Uint32>(character);
}
}
return Output;
return output;
}
@ -323,51 +323,51 @@ inline Out Unicode::UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacemen
/// to an UTF-8 characters range, using the given locale
////////////////////////////////////////////////////////////
template <typename In, typename Out>
inline Out Unicode::UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement)
inline Out Unicode::UTF32ToUTF8(In begin, In end, Out output, Uint8 replacement)
{
while (Begin < End)
while (begin < end)
{
Uint32 c = *Begin++;
if (c > 0x0010FFFF)
Uint32 character = *begin++;
if (character > 0x0010FFFF)
{
// Invalid character (greater than the maximum unicode value)
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
else
{
// Valid character
// Get number of bytes to write
int BytesToWrite = 1;
if (c < 0x80) BytesToWrite = 1;
else if (c < 0x800) BytesToWrite = 2;
else if (c < 0x10000) BytesToWrite = 3;
else if (c <= 0x0010FFFF) BytesToWrite = 4;
int bytesToWrite = 1;
if (character < 0x80) bytesToWrite = 1;
else if (character < 0x800) bytesToWrite = 2;
else if (character < 0x10000) bytesToWrite = 3;
else if (character <= 0x0010FFFF) bytesToWrite = 4;
// Extract bytes to write
Uint8 Bytes[4];
switch (BytesToWrite)
Uint8 bytes[4];
switch (bytesToWrite)
{
case 4 : Bytes[3] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
case 3 : Bytes[2] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
case 2 : Bytes[1] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
case 1 : Bytes[0] = static_cast<Uint8> (c | UTF8FirstBytes[BytesToWrite]);
case 4 : bytes[3] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
case 3 : bytes[2] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
case 2 : bytes[1] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
case 1 : bytes[0] = static_cast<Uint8> (character | UTF8FirstBytes[bytesToWrite]);
}
// Add them to the output
const Uint8* CurByte = Bytes;
switch (BytesToWrite)
const Uint8* currentByte = bytes;
switch (bytesToWrite)
{
case 4 : *Output++ = *CurByte++;
case 3 : *Output++ = *CurByte++;
case 2 : *Output++ = *CurByte++;
case 1 : *Output++ = *CurByte++;
case 4 : *output++ = *currentByte++;
case 3 : *output++ = *currentByte++;
case 2 : *output++ = *currentByte++;
case 1 : *output++ = *currentByte++;
}
}
}
return Output;
return output;
}
@ -376,42 +376,42 @@ inline Out Unicode::UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement)
/// to an UTF-16 characters range, using the given locale
////////////////////////////////////////////////////////////
template <typename In, typename Out>
inline Out Unicode::UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacement)
inline Out Unicode::UTF32ToUTF16(In begin, In end, Out output, Uint16 replacement)
{
while (Begin < End)
while (begin < end)
{
Uint32 c = *Begin++;
if (c < 0xFFFF)
Uint32 character = *begin++;
if (character < 0xFFFF)
{
// Character can be converted directly to 16 bits, just need to check it's in the valid range
if ((c >= 0xD800) && (c <= 0xDFFF))
if ((character >= 0xD800) && (character <= 0xDFFF))
{
// Invalid character (this range is reserved)
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
else
{
// Valid character directly convertible to 16 bits
*Output++ = static_cast<Uint16>(c);
*output++ = static_cast<Uint16>(character);
}
}
else if (c > 0x0010FFFF)
else if (character > 0x0010FFFF)
{
// Invalid character (greater than the maximum unicode value)
if (Replacement)
*Output++ = Replacement;
if (replacement)
*output++ = replacement;
}
else
{
// Character will be converted to 2 UTF-16 elements
c -= 0x0010000;
*Output++ = static_cast<Uint16>((c >> 10) + 0xD800);
*Output++ = static_cast<Uint16>((c & 0x3FFUL) + 0xDC00);
character -= 0x0010000;
*output++ = static_cast<Uint16>((character >> 10) + 0xD800);
*output++ = static_cast<Uint16>((character & 0x3FFUL) + 0xDC00);
}
}
return Output;
return output;
}
@ -419,19 +419,19 @@ inline Out Unicode::UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacemen
/// Get the number of characters composing an UTF-8 string
////////////////////////////////////////////////////////////
template <typename In>
inline std::size_t Unicode::GetUTF8Length(In Begin, In End)
inline std::size_t Unicode::GetUTF8Length(In begin, In end)
{
std::size_t Length = 0;
while (Begin < End)
std::size_t length = 0;
while (begin < end)
{
int NbBytes = UTF8TrailingBytes[static_cast<int>(*Begin)];
if (Begin + NbBytes < End)
++Length;
int nbBytes = UTF8TrailingBytes[static_cast<int>(*begin)];
if (begin + nbBytes < end)
++length;
Begin += NbBytes + 1;
begin += nbBytes + 1;
}
return Length;
return length;
}
@ -439,28 +439,28 @@ inline std::size_t Unicode::GetUTF8Length(In Begin, In End)
/// Get the number of characters composing an UTF-16 string
////////////////////////////////////////////////////////////
template <typename In>
inline std::size_t Unicode::GetUTF16Length(In Begin, In End)
inline std::size_t Unicode::GetUTF16Length(In begin, In end)
{
std::size_t Length = 0;
while (Begin < End)
std::size_t length = 0;
while (begin < end)
{
if ((*Begin >= 0xD800) && (*Begin <= 0xDBFF))
if ((*begin >= 0xD800) && (*begin <= 0xDBFF))
{
++Begin;
if ((Begin < End) && ((*Begin >= 0xDC00) && (*Begin <= 0xDFFF)))
++begin;
if ((begin < end) && ((*begin >= 0xDC00) && (*begin <= 0xDFFF)))
{
++Length;
++length;
}
}
else
{
++Length;
++length;
}
++Begin;
++begin;
}
return Length;
return length;
}
@ -468,7 +468,7 @@ inline std::size_t Unicode::GetUTF16Length(In Begin, In End)
/// Get the number of characters composing an UTF-32 string
////////////////////////////////////////////////////////////
template <typename In>
inline std::size_t Unicode::GetUTF32Length(In Begin, In End)
inline std::size_t Unicode::GetUTF32Length(In begin, In end)
{
return End - Begin;
return end - begin;
}

View file

@ -63,145 +63,145 @@ public :
////////////////////////////////////////////////////////////
/// Operator - overload ; returns the opposite of a vector
///
/// \param V : Vector to negate
/// \param left : Vector to negate
///
/// \return -V
/// \return -left
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator -(const Vector2<T>& V);
Vector2<T> operator -(const Vector2<T>& left);
////////////////////////////////////////////////////////////
/// Operator += overload ; add two vectors and assign to the first op
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return V1 + V2
/// \return left + right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2);
Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right);
////////////////////////////////////////////////////////////
/// Operator -= overload ; subtract two vectors and assign to the first op
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return V1 - V2
/// \return left - right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2);
Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right);
////////////////////////////////////////////////////////////
/// Operator + overload ; adds two vectors
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return V1 + V2
/// \return left + right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2);
Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right);
////////////////////////////////////////////////////////////
/// Operator - overload ; subtracts two vectors
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return V1 - V2
/// \return left - right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2);
Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right);
////////////////////////////////////////////////////////////
/// Operator * overload ; multiply a vector by a scalar value
///
/// \param V : Vector
/// \param X : Scalar value
/// \param left : Vector
/// \param right : Scalar value
///
/// \return V * X
/// \return left * right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator *(const Vector2<T>& V, T X);
Vector2<T> operator *(const Vector2<T>& left, T right);
////////////////////////////////////////////////////////////
/// Operator * overload ; multiply a scalar value by a vector
///
/// \param X : Scalar value
/// \param V : Vector
/// \param left : Scalar value
/// \param right : Vector
///
/// \return X * V
/// \return left * right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator *(T X, const Vector2<T>& V);
Vector2<T> operator *(T left, const Vector2<T>& right);
////////////////////////////////////////////////////////////
/// Operator *= overload ; multiply-assign a vector by a scalar value
///
/// \param V : Vector
/// \param X : Scalar value
/// \param left : Vector
/// \param right : Scalar value
///
/// \return V * X
/// \return left * right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T>& operator *=(Vector2<T>& V, T X);
Vector2<T>& operator *=(Vector2<T>& left, T right);
////////////////////////////////////////////////////////////
/// Operator / overload ; divide a vector by a scalar value
///
/// \param V : Vector
/// \param X : Scalar value
/// \param left : Vector
/// \param right : Scalar value
///
/// \return V / X
/// \return left / right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator /(const Vector2<T>& V, T X);
Vector2<T> operator /(const Vector2<T>& left, T right);
////////////////////////////////////////////////////////////
/// Operator /= overload ; divide-assign a vector by a scalar value
///
/// \param V : Vector
/// \param X : Scalar value
/// \param left : Vector
/// \param right : Scalar value
///
/// \return V / X
/// \return left / right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T>& operator /=(Vector2<T>& V, T X);
Vector2<T>& operator /=(Vector2<T>& left, T right);
////////////////////////////////////////////////////////////
/// Operator == overload ; compares the equality of two vectors
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return True if V1 is equal to V2
/// \return True if left is equal to right
///
////////////////////////////////////////////////////////////
template <typename T>
bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2);
bool operator ==(const Vector2<T>& left, const Vector2<T>& right);
////////////////////////////////////////////////////////////
/// Operator != overload ; compares the difference of two vectors
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return True if V1 is different than V2
/// \return True if left is different than right
///
////////////////////////////////////////////////////////////
template <typename T>
bool operator !=(const Vector2<T>& V1, const Vector2<T>& V2);
bool operator !=(const Vector2<T>& left, const Vector2<T>& right);
#include <SFML/System/Vector2.inl>

View file

@ -51,9 +51,9 @@ y(Y)
/// Operator - overload ; returns the opposite of a vector
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator -(const Vector2<T>& V)
Vector2<T> operator -(const Vector2<T>& left)
{
return Vector2<T>(-V.x, -V.y);
return Vector2<T>(-left.x, -left.y);
}
@ -61,12 +61,12 @@ Vector2<T> operator -(const Vector2<T>& V)
/// Operator += overload ; add two vectors and assign to the first op
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2)
Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right)
{
V1.x += V2.x;
V1.y += V2.y;
left.x += right.x;
left.y += right.y;
return V1;
return left;
}
@ -74,12 +74,12 @@ Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2)
/// Operator -= overload ; subtract two vectors and assign to the first op
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2)
Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right)
{
V1.x -= V2.x;
V1.y -= V2.y;
left.x -= right.x;
left.y -= right.y;
return V1;
return left;
}
@ -87,9 +87,9 @@ Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2)
/// Operator + overload ; adds two vectors
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2)
Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right)
{
return Vector2<T>(V1.x + V2.x, V1.y + V2.y);
return Vector2<T>(left.x + right.x, left.y + right.y);
}
@ -97,9 +97,9 @@ Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2)
/// Operator - overload ; subtracts two vectors
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2)
Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right)
{
return Vector2<T>(V1.x - V2.x, V1.y - V2.y);
return Vector2<T>(left.x - right.x, left.y - right.y);
}
@ -107,9 +107,9 @@ Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2)
/// Operator * overload ; multiply a vector by a scalar value
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator *(const Vector2<T>& V, T X)
Vector2<T> operator *(const Vector2<T>& left, T right)
{
return Vector2<T>(V.x * X, V.y * X);
return Vector2<T>(left.x * right, left.y * right);
}
@ -117,9 +117,9 @@ Vector2<T> operator *(const Vector2<T>& V, T X)
/// Operator * overload ; multiply a scalar value by a vector
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator *(T X, const Vector2<T>& V)
Vector2<T> operator *(T left, const Vector2<T>& right)
{
return Vector2<T>(V.x * X, V.y * X);
return Vector2<T>(right.x * left, right.y * left);
}
@ -127,12 +127,12 @@ Vector2<T> operator *(T X, const Vector2<T>& V)
/// Operator *= overload ; multiply-assign a vector by a scalar value
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T>& operator *=(Vector2<T>& V, T X)
Vector2<T>& operator *=(Vector2<T>& left, T right)
{
V.x *= X;
V.y *= X;
left.x *= right;
left.y *= right;
return V;
return left;
}
@ -140,9 +140,9 @@ Vector2<T>& operator *=(Vector2<T>& V, T X)
/// Operator / overload ; divide a vector by a scalar value
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator /(const Vector2<T>& V, T X)
Vector2<T> operator /(const Vector2<T>& left, T right)
{
return Vector2<T>(V.x / X, V.y / X);
return Vector2<T>(left.x / right, left.y / right);
}
@ -150,12 +150,12 @@ Vector2<T> operator /(const Vector2<T>& V, T X)
/// Operator /= overload ; divide-assign a vector by a scalar value
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T>& operator /=(Vector2<T>& V, T X)
Vector2<T>& operator /=(Vector2<T>& left, T right)
{
V.x /= X;
V.y /= X;
left.x /= right;
left.y /= right;
return V;
return left;
}
@ -163,9 +163,9 @@ Vector2<T>& operator /=(Vector2<T>& V, T X)
/// Operator == overload ; compares the equality of two vectors
////////////////////////////////////////////////////////////
template <typename T>
bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2)
bool operator ==(const Vector2<T>& left, const Vector2<T>& right)
{
return (V1.x == V2.x) && (V1.y == V2.y);
return (left.x == right.x) && (left.y == right.y);
}
@ -173,7 +173,7 @@ bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2)
/// Operator != overload ; compares the difference of two vectors
////////////////////////////////////////////////////////////
template <typename T>
bool operator !=(const Vector2<T>& V1, const Vector2<T>& V2)
bool operator !=(const Vector2<T>& left, const Vector2<T>& right)
{
return (V1.x != V2.x) || (V1.y != V2.y);
return (left.x != right.x) || (left.y != right.y);
}

View file

@ -65,145 +65,145 @@ public :
////////////////////////////////////////////////////////////
/// Operator - overload ; returns the opposite of a vector
///
/// \param V : Vector to negate
/// \param left : Vector to negate
///
/// \return -V
/// \return -left
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator -(const Vector3<T>& V);
Vector3<T> operator -(const Vector3<T>& left);
////////////////////////////////////////////////////////////
/// Operator += overload ; add two vectors and assign to the first op
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return V1 + V2
/// \return left + V2
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2);
Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right);
////////////////////////////////////////////////////////////
/// Operator -= overload ; subtract two vectors and assign to the first op
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return V1 - V2
/// \return left - right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2);
Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right);
////////////////////////////////////////////////////////////
/// Operator + overload ; adds two vectors
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return V1 + V2
/// \return left + right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2);
Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right);
////////////////////////////////////////////////////////////
/// Operator - overload ; subtracts two vectors
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return V1 - V2
/// \return left - rightright
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2);
Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right);
////////////////////////////////////////////////////////////
/// Operator * overload ; multiply a vector by a scalar value
///
/// \param V : Vector
/// \param X : Scalar value
/// \param left : Vector
/// \param right : Scalar value
///
/// \return V * X
/// \return left * right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator *(const Vector3<T>& V, T X);
Vector3<T> operator *(const Vector3<T>& left, T right);
////////////////////////////////////////////////////////////
/// Operator * overload ; multiply a scalar value by a vector
///
/// \param X : Scalar value
/// \param V : Vector
/// \param left : Scalar value
/// \param right : Vector
///
/// \return X * V
/// \return left * right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator *(T X, const Vector3<T>& V);
Vector3<T> operator *(T left, const Vector3<T>& right);
////////////////////////////////////////////////////////////
/// Operator *= overload ; multiply-assign a vector by a scalar value
///
/// \param V : Vector
/// \param X : Scalar value
/// \param left : Vector
/// \param right : Scalar value
///
/// \return V * X
/// \return left * right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T>& operator *=(Vector3<T>& V, T X);
Vector3<T>& operator *=(Vector3<T>& left, T right);
////////////////////////////////////////////////////////////
/// Operator / overload ; divide a vector by a scalar value
///
/// \param V : Vector
/// \param X : Scalar value
/// \param left : Vector
/// \param right : Scalar value
///
/// \return V / X
/// \return left / right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator /(const Vector3<T>& V, T X);
Vector3<T> operator /(const Vector3<T>& left, T right);
////////////////////////////////////////////////////////////
/// Operator /= overload ; divide-assign a vector by a scalar value
///
/// \param V : Vector
/// \param X : Scalar value
/// \param left : Vector
/// \param right : Scalar value
///
/// \return V / X
/// \return left / right
///
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T>& operator /=(Vector3<T>& V, T X);
Vector3<T>& operator /=(Vector3<T>& left, T right);
////////////////////////////////////////////////////////////
/// Operator == overload ; compares the equality of two vectors
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return True if V1 is equal to V2
/// \return True if left is equal to right
///
////////////////////////////////////////////////////////////
template <typename T>
bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2);
bool operator ==(const Vector3<T>& left, const Vector3<T>& right);
////////////////////////////////////////////////////////////
/// Operator != overload ; compares the difference of two vectors
///
/// \param V1 : First vector
/// \param V2 : Second vector
/// \param left : First vector
/// \param right : Second vector
///
/// \return True if V1 is different than V2
/// \return True if left is different than right
///
////////////////////////////////////////////////////////////
template <typename T>
bool operator !=(const Vector3<T>& V1, const Vector3<T>& V2);
bool operator !=(const Vector3<T>& left, const Vector3<T>& right);
#include <SFML/System/Vector3.inl>

View file

@ -53,9 +53,9 @@ z(Z)
/// Operator - overload ; returns the opposite of a vector
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator -(const Vector3<T>& V)
Vector3<T> operator -(const Vector3<T>& left)
{
return Vector3<T>(-V.x, -V.y, -V.z);
return Vector3<T>(-left.x, -left.y, -left.z);
}
@ -63,13 +63,13 @@ Vector3<T> operator -(const Vector3<T>& V)
/// Operator += overload ; add two vectors and assign to the first op
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2)
Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right)
{
V1.x += V2.x;
V1.y += V2.y;
V1.z += V2.z;
left.x += right.x;
left.y += right.y;
left.z += right.z;
return V1;
return left;
}
@ -77,13 +77,13 @@ Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2)
/// Operator -= overload ; subtract two vectors and assign to the first op
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2)
Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right)
{
V1.x -= V2.x;
V1.y -= V2.y;
V1.z -= V2.z;
left.x -= right.x;
left.y -= right.y;
left.z -= right.z;
return V1;
return left;
}
@ -91,9 +91,9 @@ Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2)
/// Operator + overload ; adds two vectors
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2)
Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right)
{
return Vector3<T>(V1.x + V2.x, V1.y + V2.y, V1.z + V2.z);
return Vector3<T>(left.x + right.x, left.y + right.y, left.z + right.z);
}
@ -101,9 +101,9 @@ Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2)
/// Operator - overload ; subtracts two vectors
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2)
Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right)
{
return Vector3<T>(V1.x - V2.x, V1.y - V2.y, V1.z - V2.z);
return Vector3<T>(left.x - right.x, left.y - right.y, left.z - right.z);
}
@ -111,9 +111,9 @@ Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2)
/// Operator * overload ; multiply a vector by a scalar value
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator *(const Vector3<T>& V, T X)
Vector3<T> operator *(const Vector3<T>& left, T right)
{
return Vector3<T>(V.x * X, V.y * X, V.z * X);
return Vector3<T>(left.x * right, left.y * right, left.z * right);
}
@ -121,9 +121,9 @@ Vector3<T> operator *(const Vector3<T>& V, T X)
/// Operator * overload ; multiply a scalar value by a vector
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator *(T X, const Vector3<T>& V)
Vector3<T> operator *(T left, const Vector3<T>& right)
{
return Vector3<T>(V.x * X, V.y * X, V.z * X);
return Vector3<T>(right.x * left, right.y * left, right.z * left);
}
@ -131,13 +131,13 @@ Vector3<T> operator *(T X, const Vector3<T>& V)
/// Operator *= overload ; multiply-assign a vector by a scalar value
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T>& operator *=(Vector3<T>& V, T X)
Vector3<T>& operator *=(Vector3<T>& left, T right)
{
V.x *= X;
V.y *= X;
V.z *= X;
left.x *= right;
left.y *= right;
left.z *= right;
return V;
return left;
}
@ -145,9 +145,9 @@ Vector3<T>& operator *=(Vector3<T>& V, T X)
/// Operator / overload ; divide a vector by a scalar value
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T> operator /(const Vector3<T>& V, T X)
Vector3<T> operator /(const Vector3<T>& left, T right)
{
return Vector3<T>(V.x / X, V.y / X, V.z / X);
return Vector3<T>(left.x / right, left.y / right, left.z / right);
}
@ -155,13 +155,13 @@ Vector3<T> operator /(const Vector3<T>& V, T X)
/// Operator /= overload ; divide-assign a vector by a scalar value
////////////////////////////////////////////////////////////
template <typename T>
Vector3<T>& operator /=(Vector3<T>& V, T X)
Vector3<T>& operator /=(Vector3<T>& left, T right)
{
V.x /= X;
V.y /= X;
V.z /= X;
left.x /= right;
left.y /= right;
left.z /= right;
return V;
return left;
}
@ -169,9 +169,9 @@ Vector3<T>& operator /=(Vector3<T>& V, T X)
/// Operator == overload ; compares the equality of two vectors
////////////////////////////////////////////////////////////
template <typename T>
bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2)
bool operator ==(const Vector3<T>& left, const Vector3<T>& V2)
{
return (V1.x == V2.x) && (V1.y == V2.y) && (V1.z == V2.z);
return (left.x == right.x) && (left.y == right.y) && (left.z == right.z);
}
@ -179,7 +179,7 @@ bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2)
/// Operator != overload ; compares the difference of two vectors
////////////////////////////////////////////////////////////
template <typename T>
bool operator !=(const Vector3<T>& V1, const Vector3<T>& V2)
bool operator !=(const Vector3<T>& left, const Vector3<T>& right)
{
return (V1.x != V2.x) || (V1.y != V2.y) || (V1.z != V2.z);
return (left.x != right.x) || (left.y != right.y) || (left.z != right.z);
}