From d99933ddd9845fde28cdc454e514c6d37df2f966 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sun, 16 Mar 2008 18:09:25 +0000 Subject: [PATCH] Fixed all Gorgonsub headers (mental note: namespaces don't end with a semi-colon) and added some VC9/ICL projects. Originally committed to SVN as r2070. --- aegilib/aegilib.vcproj | 1 + aegilib/aegilib_2008.vcproj | 435 +++++++++++++++++ aegilib/aegilib_icl.icproj | 246 ++++++++++ aegilib/aegilib_icl.vcproj | 436 ++++++++++++++++++ aegilib/include/aegilib/action.h | 2 +- aegilib/include/aegilib/actionlist.h | 2 +- aegilib/include/aegilib/colour.h | 2 +- aegilib/include/aegilib/controller.h | 142 +++--- aegilib/include/aegilib/deltacoder.h | 2 +- aegilib/include/aegilib/exception.h | 8 +- aegilib/include/aegilib/fastbuffer.h | 2 +- aegilib/include/aegilib/format.h | 2 +- aegilib/include/aegilib/format_handler.h | 2 +- aegilib/include/aegilib/format_manager.h | 2 +- aegilib/include/aegilib/gorgonstring.h | 2 +- aegilib/include/aegilib/gorgontime.h | 2 +- aegilib/include/aegilib/model.h | 2 +- aegilib/include/aegilib/notification.h | 2 +- aegilib/include/aegilib/section.h | 4 +- aegilib/include/aegilib/section_entry.h | 2 +- .../include/aegilib/section_entry_dialogue.h | 4 +- aegilib/include/aegilib/section_entry_style.h | 4 +- aegilib/include/aegilib/serialize.h | 2 +- aegilib/include/aegilib/tokenizer.h | 2 +- aegilib/include/aegilib/tr1.h | 8 +- aegilib/include/aegilib/utils.h | 2 +- aegilib/include/aegilib/version.h | 2 +- aegilib/include/aegilib/view.h | 2 +- aegilib/src/exception.cpp | 35 +- aegilib/src/formats/format_ass.h | 2 +- aegilib/src/formats/format_ass_dialogue.h | 2 +- .../src/formats/format_ass_dialogue_delta.cpp | 13 +- .../src/formats/format_ass_dialogue_delta.h | 2 +- aegilib/src/formats/format_ass_plain.h | 2 +- aegilib/src/formats/format_ass_style.h | 2 +- aegilib/src/text_file_writer.h | 2 +- aegilib/test/src/main.cpp | 5 +- aegilib/test/test_2008.vcproj | 203 ++++++++ aegilib/test/test_icl.icproj | 169 +++++++ aegilib/test/test_icl.vcproj | 203 ++++++++ 40 files changed, 1834 insertions(+), 130 deletions(-) create mode 100644 aegilib/aegilib_2008.vcproj create mode 100644 aegilib/aegilib_icl.icproj create mode 100644 aegilib/aegilib_icl.vcproj create mode 100644 aegilib/test/test_2008.vcproj create mode 100644 aegilib/test/test_icl.icproj create mode 100644 aegilib/test/test_icl.vcproj diff --git a/aegilib/aegilib.vcproj b/aegilib/aegilib.vcproj index d1ce38260..001153252 100644 --- a/aegilib/aegilib.vcproj +++ b/aegilib/aegilib.vcproj @@ -111,6 +111,7 @@ AdditionalIncludeDirectories="include/aegilib" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WINDOWS" RuntimeLibrary="2" + OpenMP="true" UsePrecompiledHeader="2" PrecompiledHeaderThrough="prec.h" WarningLevel="4" diff --git a/aegilib/aegilib_2008.vcproj b/aegilib/aegilib_2008.vcproj new file mode 100644 index 000000000..58e43fd0e --- /dev/null +++ b/aegilib/aegilib_2008.vcproj @@ -0,0 +1,435 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aegilib/aegilib_icl.icproj b/aegilib/aegilib_icl.icproj new file mode 100644 index 000000000..5e582e85c --- /dev/null +++ b/aegilib/aegilib_icl.icproj @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aegilib/aegilib_icl.vcproj b/aegilib/aegilib_icl.vcproj new file mode 100644 index 000000000..9e6395873 --- /dev/null +++ b/aegilib/aegilib_icl.vcproj @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aegilib/include/aegilib/action.h b/aegilib/include/aegilib/action.h index 2ae5893af..8bae0e8e4 100644 --- a/aegilib/include/aegilib/action.h +++ b/aegilib/include/aegilib/action.h @@ -101,4 +101,4 @@ namespace Gorgonsub { ActionPtr GetAntiAction(const Model &model) const; void Execute(Model &model); }; -}; +} diff --git a/aegilib/include/aegilib/actionlist.h b/aegilib/include/aegilib/actionlist.h index 0ce99fd10..abc65a029 100644 --- a/aegilib/include/aegilib/actionlist.h +++ b/aegilib/include/aegilib/actionlist.h @@ -76,4 +76,4 @@ namespace Gorgonsub { }; typedef shared_ptr ActionListPtr; -}; +} diff --git a/aegilib/include/aegilib/colour.h b/aegilib/include/aegilib/colour.h index 34741d6fe..1a78d63ff 100644 --- a/aegilib/include/aegilib/colour.h +++ b/aegilib/include/aegilib/colour.h @@ -66,4 +66,4 @@ namespace Gorgonsub { String GetVBHex(bool withAlpha=false,bool withHeader=true,bool withFooter=true) const; }; -}; +} diff --git a/aegilib/include/aegilib/controller.h b/aegilib/include/aegilib/controller.h index f347fbf8f..6ae9e9885 100644 --- a/aegilib/include/aegilib/controller.h +++ b/aegilib/include/aegilib/controller.h @@ -1,71 +1,71 @@ -// Copyright (c) 2008, Rodrigo Braz Monteiro -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of the Aegisub Group nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// ----------------------------------------------------------------------------- -// -// AEGISUB/GORGONSUB -// -// Website: http://www.aegisub.net -// Contact: mailto:amz@aegisub.net -// - -#pragma once -#include "gorgonstring.h" -#include "tr1.h" -#include "format.h" - -namespace Gorgonsub { - - // Prototypes - class Model; - class ActionList; - typedef shared_ptr ActionListPtr; - - // Controller class - class Controller { - private: - Model &model; - - public: - Controller (Model &model); - ActionListPtr CreateActionList(const String title,const String owner=L"",bool undoAble=true); - - void LoadFile(const String filename,const String encoding=L""); - void SaveFile(const String filename,const String encoding=L"UTF-8"); - - bool CanUndo(const String owner=L"") const; - bool CanRedo(const String owner=L"") const; - void Undo(const String owner=L""); - void Redo(const String owner=L""); - - SectionEntryDialoguePtr CreateDialogue(); - SectionEntryStylePtr CreateStyle(); - - const FormatPtr GetFormat() const; - }; - -}; +// Copyright (c) 2008, Rodrigo Braz Monteiro +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of the Aegisub Group nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +// ----------------------------------------------------------------------------- +// +// AEGISUB/GORGONSUB +// +// Website: http://www.aegisub.net +// Contact: mailto:amz@aegisub.net +// + +#pragma once +#include "gorgonstring.h" +#include "tr1.h" +#include "format.h" + +namespace Gorgonsub { + + // Prototypes + class Model; + class ActionList; + typedef shared_ptr ActionListPtr; + + // Controller class + class Controller { + private: + Model &model; + + public: + Controller (Model &model); + ActionListPtr CreateActionList(const String title,const String owner=L"",bool undoAble=true); + + void LoadFile(const String filename,const String encoding=L""); + void SaveFile(const String filename,const String encoding=L"UTF-8"); + + bool CanUndo(const String owner=L"") const; + bool CanRedo(const String owner=L"") const; + void Undo(const String owner=L""); + void Redo(const String owner=L""); + + SectionEntryDialoguePtr CreateDialogue(); + SectionEntryStylePtr CreateStyle(); + + const FormatPtr GetFormat() const; + }; + +} diff --git a/aegilib/include/aegilib/deltacoder.h b/aegilib/include/aegilib/deltacoder.h index 1c7490336..d73a12568 100644 --- a/aegilib/include/aegilib/deltacoder.h +++ b/aegilib/include/aegilib/deltacoder.h @@ -51,4 +51,4 @@ namespace Gorgonsub { }; typedef shared_ptr DeltaCoderPtr; -}; +} diff --git a/aegilib/include/aegilib/exception.h b/aegilib/include/aegilib/exception.h index 5f094c66b..9c8f06196 100644 --- a/aegilib/include/aegilib/exception.h +++ b/aegilib/include/aegilib/exception.h @@ -58,16 +58,16 @@ namespace Gorgonsub { Exception(ExceptionList code); Exception(ExceptionList code,const char* file,const long line); - String GetMessage() const { return wxString(what(),wxConvLocal); } + String GetMessageString() const { return wxString(what(),wxConvLocal); } int GetCode(); private: - static String GetMessage(int code); - static String GetMessageFile(int code,const char *file,long line); + static const char* GetMessageChar(int code); + static const char* GetMessageFile(int code,const char *file,long line); ExceptionList code; }; -}; +} #ifdef _MSC_VER #define THROW_GORGON_EXCEPTION(code) throw Gorgonsub::Exception(code,__FILE__,__LINE__) diff --git a/aegilib/include/aegilib/fastbuffer.h b/aegilib/include/aegilib/fastbuffer.h index f729e8755..be073d2f0 100644 --- a/aegilib/include/aegilib/fastbuffer.h +++ b/aegilib/include/aegilib/fastbuffer.h @@ -102,4 +102,4 @@ namespace Gorgonsub { } } }; -}; +} diff --git a/aegilib/include/aegilib/format.h b/aegilib/include/aegilib/format.h index 941b93545..ca8c8676e 100644 --- a/aegilib/include/aegilib/format.h +++ b/aegilib/include/aegilib/format.h @@ -72,4 +72,4 @@ namespace Gorgonsub { }; typedef shared_ptr FormatPtr; -}; +} diff --git a/aegilib/include/aegilib/format_handler.h b/aegilib/include/aegilib/format_handler.h index a7e839a65..2f171e917 100644 --- a/aegilib/include/aegilib/format_handler.h +++ b/aegilib/include/aegilib/format_handler.h @@ -63,4 +63,4 @@ namespace Gorgonsub { }; typedef shared_ptr FormatHandlerPtr; -}; +} diff --git a/aegilib/include/aegilib/format_manager.h b/aegilib/include/aegilib/format_manager.h index b26981ea7..920395c7b 100644 --- a/aegilib/include/aegilib/format_manager.h +++ b/aegilib/include/aegilib/format_manager.h @@ -55,4 +55,4 @@ namespace Gorgonsub { static const FormatPtr GetFormatFromName(const String &name); }; -}; +} diff --git a/aegilib/include/aegilib/gorgonstring.h b/aegilib/include/aegilib/gorgonstring.h index 9c24cfb3a..8ef01a473 100644 --- a/aegilib/include/aegilib/gorgonstring.h +++ b/aegilib/include/aegilib/gorgonstring.h @@ -45,4 +45,4 @@ namespace Gorgonsub { typedef wxString String; typedef std::vector StringArray; -}; +} diff --git a/aegilib/include/aegilib/gorgontime.h b/aegilib/include/aegilib/gorgontime.h index 5e96f69e7..91bd395ca 100644 --- a/aegilib/include/aegilib/gorgontime.h +++ b/aegilib/include/aegilib/gorgontime.h @@ -61,4 +61,4 @@ namespace Gorgonsub { bool operator >= (const Time &par) const { return ms >= par.ms; } }; -}; +} diff --git a/aegilib/include/aegilib/model.h b/aegilib/include/aegilib/model.h index 221bd30ee..e0da018ac 100644 --- a/aegilib/include/aegilib/model.h +++ b/aegilib/include/aegilib/model.h @@ -94,4 +94,4 @@ namespace Gorgonsub { void AddListener(ViewPtr listener); }; -}; +} diff --git a/aegilib/include/aegilib/notification.h b/aegilib/include/aegilib/notification.h index 4709ba877..dd4fcd40c 100644 --- a/aegilib/include/aegilib/notification.h +++ b/aegilib/include/aegilib/notification.h @@ -46,4 +46,4 @@ namespace Gorgonsub { std::vector lines; }; -}; +} diff --git a/aegilib/include/aegilib/section.h b/aegilib/include/aegilib/section.h index f2268eeca..57909bc06 100644 --- a/aegilib/include/aegilib/section.h +++ b/aegilib/include/aegilib/section.h @@ -54,7 +54,7 @@ namespace Gorgonsub { ~Section() {} // Section name - String SetName(const String& newName) { name = newName; } + void SetName(const String& newName) { name = newName; } const String& GetName() const { return name; } // Script properties @@ -75,4 +75,4 @@ namespace Gorgonsub { }; typedef shared_ptr
SectionPtr; -}; +} diff --git a/aegilib/include/aegilib/section_entry.h b/aegilib/include/aegilib/section_entry.h index 6a9ca61a0..bbd5458ac 100644 --- a/aegilib/include/aegilib/section_entry.h +++ b/aegilib/include/aegilib/section_entry.h @@ -99,4 +99,4 @@ namespace Gorgonsub { virtual void SetText(const String &_data) =0; }; -}; +} diff --git a/aegilib/include/aegilib/section_entry_dialogue.h b/aegilib/include/aegilib/section_entry_dialogue.h index 839b0f320..14486e1c1 100644 --- a/aegilib/include/aegilib/section_entry_dialogue.h +++ b/aegilib/include/aegilib/section_entry_dialogue.h @@ -45,7 +45,7 @@ namespace Gorgonsub { // Dialogue class class SectionEntryDialogue : public SectionEntry { private: - const static bool dodgeWarning = true; + static const bool dodgeWarning = true; void ThrowUnsupported() const { if (dodgeWarning) throw Exception(Exception::Unsupported_Format_Feature); } public: @@ -92,4 +92,4 @@ namespace Gorgonsub { virtual void SetUserField(const String& userField) { (void) userField; ThrowUnsupported(); } }; -}; +} diff --git a/aegilib/include/aegilib/section_entry_style.h b/aegilib/include/aegilib/section_entry_style.h index 8f685e226..6ec729662 100644 --- a/aegilib/include/aegilib/section_entry_style.h +++ b/aegilib/include/aegilib/section_entry_style.h @@ -45,7 +45,7 @@ namespace Gorgonsub { // Style class class SectionEntryStyle : public SectionEntry { private: - const static bool dodgeWarning = true; + static const bool dodgeWarning = true; void ThrowUnsupported() const { if (dodgeWarning) throw Exception(Exception::Unsupported_Format_Feature); } public: @@ -64,4 +64,4 @@ namespace Gorgonsub { virtual int GetMargin(int n) const { (void) n; ThrowUnsupported(); return 0; } }; -}; +} diff --git a/aegilib/include/aegilib/serialize.h b/aegilib/include/aegilib/serialize.h index 905ffcca4..ff2abf5c8 100644 --- a/aegilib/include/aegilib/serialize.h +++ b/aegilib/include/aegilib/serialize.h @@ -43,4 +43,4 @@ namespace Gorgonsub { virtual ~SerializeText(){} virtual String ToText(int param) const=0; }; -}; +} diff --git a/aegilib/include/aegilib/tokenizer.h b/aegilib/include/aegilib/tokenizer.h index cece26e26..b937cf29e 100644 --- a/aegilib/include/aegilib/tokenizer.h +++ b/aegilib/include/aegilib/tokenizer.h @@ -61,4 +61,4 @@ namespace Gorgonsub { bool GetBool(); }; -}; +} diff --git a/aegilib/include/aegilib/tr1.h b/aegilib/include/aegilib/tr1.h index cd14e63d1..5ff081330 100644 --- a/aegilib/include/aegilib/tr1.h +++ b/aegilib/include/aegilib/tr1.h @@ -54,4 +54,10 @@ namespace Gorgonsub { public: void operator()(void const *) const { } }; -}; + + // Array deleter for use with shared_ptr and new[] + class ArrayDeleter { + public: + void operator()(void const *p) const { delete[] p; } + }; +} diff --git a/aegilib/include/aegilib/utils.h b/aegilib/include/aegilib/utils.h index 0d5f3ebd8..378025e27 100644 --- a/aegilib/include/aegilib/utils.h +++ b/aegilib/include/aegilib/utils.h @@ -96,4 +96,4 @@ namespace Gorgonsub { const wxChar *StringPtrTrim(wxChar *str,size_t len,size_t start); const wxChar *StringTrim(wxString &str,size_t start); bool AsciiStringCompareNoCase(const wxString &str1,const wxChar *str2); -}; +} diff --git a/aegilib/include/aegilib/version.h b/aegilib/include/aegilib/version.h index 7b1d751d7..95c561e7e 100644 --- a/aegilib/include/aegilib/version.h +++ b/aegilib/include/aegilib/version.h @@ -52,4 +52,4 @@ namespace Gorgonsub { String GetHostApplicationName(); String GetHostApplicationURL(); -}; +} diff --git a/aegilib/include/aegilib/view.h b/aegilib/include/aegilib/view.h index 14ee31e70..baab03278 100644 --- a/aegilib/include/aegilib/view.h +++ b/aegilib/include/aegilib/view.h @@ -51,4 +51,4 @@ namespace Gorgonsub { void Register(Model &model); virtual void Notify(const Notification ¬ification) = 0; }; -}; +} diff --git a/aegilib/src/exception.cpp b/aegilib/src/exception.cpp index f7137d57f..6ef56ff3d 100644 --- a/aegilib/src/exception.cpp +++ b/aegilib/src/exception.cpp @@ -40,13 +40,13 @@ using namespace Gorgonsub; //////////////// // Constructors Exception::Exception(ExceptionList _code) -: std::exception(GetMessage(_code).mb_str(wxConvLocal)) +: std::exception(GetMessageChar(_code)) { code = _code; } Exception::Exception(ExceptionList _code,const char *file,const long line) -: std::exception(GetMessageFile(_code,file,line).mb_str(wxConvLocal)) +: std::exception(GetMessageFile(_code,file,line)) { code = _code; } @@ -54,28 +54,33 @@ Exception::Exception(ExceptionList _code,const char *file,const long line) ////////////////////// // Get message string -String Exception::GetMessage(int code) +const char* Exception::GetMessageChar(int code) { switch (code) { - case Unknown: return L"Unknown."; - case No_Format_Handler: return L"Could not find a suitable format handler."; - case Invalid_ActionList: return L"Invalid manipulator."; - case Section_Already_Exists: return L"The specified section already exists in this model."; - case Unknown_Format: return L"The specified file format is unknown."; - case Parse_Error: return L"Parse error."; - case Unsupported_Format_Feature: return L"This feature is not supported by this format."; - case Invalid_Token: return L"Invalid type for this token."; - case TODO: return L"TODO"; + case Unknown: return "Unknown."; + case No_Format_Handler: return "Could not find a suitable format handler."; + case Invalid_ActionList: return "Invalid manipulator."; + case Section_Already_Exists: return "The specified section already exists in this model."; + case Unknown_Format: return "The specified file format is unknown."; + case Parse_Error: return "Parse error."; + case Unsupported_Format_Feature: return "This feature is not supported by this format."; + case Invalid_Token: return "Invalid type for this token."; + case TODO: return "TODO"; } - return L"Invalid code."; + return "Invalid code."; } /////////////////////////////////// // Insert file and line on message -String Exception::GetMessageFile(int code,const char *file,long line) +const char* Exception::GetMessageFile(int code,const char *file,long line) { - return GetMessage(code) + _T(" (") + wxString(file,wxConvLocal) + wxString::Format(_T(":%i)."),line); + static std::string str = GetMessageChar(code); + str = str + " (" + file + ":"; + char buffer[16]; + _itoa_s(line,buffer,10); + str = str + buffer + ")"; + return str.c_str(); } diff --git a/aegilib/src/formats/format_ass.h b/aegilib/src/formats/format_ass.h index 14139d0ce..d05b2a81e 100644 --- a/aegilib/src/formats/format_ass.h +++ b/aegilib/src/formats/format_ass.h @@ -109,4 +109,4 @@ namespace Gorgonsub { StringArray GetWriteExtensions() const; }; -}; +} diff --git a/aegilib/src/formats/format_ass_dialogue.h b/aegilib/src/formats/format_ass_dialogue.h index f88b0fa29..6ae369fa9 100644 --- a/aegilib/src/formats/format_ass_dialogue.h +++ b/aegilib/src/formats/format_ass_dialogue.h @@ -94,4 +94,4 @@ namespace Gorgonsub { void SetUserField(const String &userField) { text[3] = userField; } }; -}; +} diff --git a/aegilib/src/formats/format_ass_dialogue_delta.cpp b/aegilib/src/formats/format_ass_dialogue_delta.cpp index e8ab51de7..8a300b7c8 100644 --- a/aegilib/src/formats/format_ass_dialogue_delta.cpp +++ b/aegilib/src/formats/format_ass_dialogue_delta.cpp @@ -43,7 +43,6 @@ using namespace Gorgonsub; - //////////////////////////////////// // Encode delta between two entries VoidPtr DialogueASSDeltaCoder::EncodeDelta(VoidPtr _from,VoidPtr _to) const @@ -69,10 +68,10 @@ VoidPtr DialogueASSDeltaCoder::EncodeDelta(VoidPtr _from,VoidPtr _to) const if (mask & (0x0010 << i)) size += 2; if (mask & (0x0100 << i)) size += (to->text[i].Length()+1)*2; } - shared_ptr > delta (new std::vector(size)); + shared_ptr delta (new char[size],ArrayDeleter()); // Write data - char *final = &delta->front(); + char *final = delta.get(); GetDelta(mask,final,to); // Return delta @@ -85,7 +84,7 @@ VoidPtr DialogueASSDeltaCoder::EncodeDelta(VoidPtr _from,VoidPtr _to) const VoidPtr DialogueASSDeltaCoder::EncodeReverseDelta(VoidPtr _delta,VoidPtr object) const { // Get mask - char *data = &(static_pointer_cast > (_delta))->front(); + char *data = (static_pointer_cast (_delta)).get(); int mask = *((short*) data); shared_ptr to = static_pointer_cast (object); @@ -94,10 +93,10 @@ VoidPtr DialogueASSDeltaCoder::EncodeReverseDelta(VoidPtr _delta,VoidPtr object) for (size_t i=0;i<4;i++) { size += (mask & (0x0010 << i)) * 2 + (mask & (0x0100 << i)) * (to->text[i].Length()+1)*2; } - shared_ptr > delta (new std::vector(size)); + shared_ptr delta (new char[size],ArrayDeleter()); // Write data - char *final = &delta->front(); + char *final = delta.get(); GetDelta(mask,final,to); return delta; } @@ -109,7 +108,7 @@ VoidPtr DialogueASSDeltaCoder::EncodeReverseDelta(VoidPtr _delta,VoidPtr object) void DialogueASSDeltaCoder::ApplyDelta(VoidPtr _delta,VoidPtr object) const { // Process parameters - char *data = &(static_pointer_cast > (_delta))->front(); + char *data = (static_pointer_cast (_delta)).get(); shared_ptr to = static_pointer_cast (object); // Read mask diff --git a/aegilib/src/formats/format_ass_dialogue_delta.h b/aegilib/src/formats/format_ass_dialogue_delta.h index c8b58e91d..fce79c17f 100644 --- a/aegilib/src/formats/format_ass_dialogue_delta.h +++ b/aegilib/src/formats/format_ass_dialogue_delta.h @@ -50,4 +50,4 @@ namespace Gorgonsub { void ApplyDelta(VoidPtr delta,VoidPtr object) const; }; -}; +} diff --git a/aegilib/src/formats/format_ass_plain.h b/aegilib/src/formats/format_ass_plain.h index 205a14130..ee61a8e56 100644 --- a/aegilib/src/formats/format_ass_plain.h +++ b/aegilib/src/formats/format_ass_plain.h @@ -57,4 +57,4 @@ namespace Gorgonsub { void SetText(const String &_data) { data = _data; } }; -}; +} diff --git a/aegilib/src/formats/format_ass_style.h b/aegilib/src/formats/format_ass_style.h index c31f77753..73ec26c6d 100644 --- a/aegilib/src/formats/format_ass_style.h +++ b/aegilib/src/formats/format_ass_style.h @@ -90,4 +90,4 @@ namespace Gorgonsub { int GetMargin(int n) const { return margin.at(n); } }; -}; +} diff --git a/aegilib/src/text_file_writer.h b/aegilib/src/text_file_writer.h index 186c613b9..9b30f63ba 100644 --- a/aegilib/src/text_file_writer.h +++ b/aegilib/src/text_file_writer.h @@ -58,4 +58,4 @@ namespace Gorgonsub { void WriteLineToFile(Gorgonsub::String line,bool addLineBreak=true); }; -}; +} diff --git a/aegilib/test/src/main.cpp b/aegilib/test/src/main.cpp index f28ae2486..a8421abfb 100644 --- a/aegilib/test/src/main.cpp +++ b/aegilib/test/src/main.cpp @@ -82,8 +82,8 @@ int main() cout << "Processing actions... "; timer.Start(); ActionListPtr actions = control.CreateActionList(L"Insert line"); - actions->InsertLine(line,2); - actions->RemoveLine(3,L"Events"); + //actions->InsertLine(line,2); + //actions->RemoveLine(3,L"Events"); SectionEntryDialoguePtr diag = dynamic_pointer_cast (actions->ModifyLine(10,L"Events")); diag->SetText(L"Hay guise sup"); actions->Finish(); @@ -102,6 +102,7 @@ int main() control.SaveFile(L"subs_out2.ass",L"UTF-8"); control.Undo(); control.SaveFile(L"subs_out3.ass",L"UTF-8"); + system("pause"); } catch (std::exception &e) { diff --git a/aegilib/test/test_2008.vcproj b/aegilib/test/test_2008.vcproj new file mode 100644 index 000000000..a09f106ea --- /dev/null +++ b/aegilib/test/test_2008.vcproj @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aegilib/test/test_icl.icproj b/aegilib/test/test_icl.icproj new file mode 100644 index 000000000..0df3ec67a --- /dev/null +++ b/aegilib/test/test_icl.icproj @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aegilib/test/test_icl.vcproj b/aegilib/test/test_icl.vcproj new file mode 100644 index 000000000..a09f106ea --- /dev/null +++ b/aegilib/test/test_icl.vcproj @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +