Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.

Document all functions, class, struct, union, enum, macro, variable, typedefs.  This isn't the actual document in itself but empty documentation using any old documentation if it was there.

This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.

Some notes:
 * Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
 * Some multiline comments may have been munged into single line comments
 * Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
 * Enum comments can go after the enumeration itself '[value] /// comment'
 * include/aegisub/*.h haven't been converted yet, this will be done in a later commit
 * Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.

See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.

Originally committed to SVN as r3312.
This commit is contained in:
Amar Takhar 2009-07-29 22:59:22 +00:00
parent d6fbe6fc8e
commit 6ee2f98349
324 changed files with 16843 additions and 3876 deletions

View file

@ -36,6 +36,8 @@
#pragma once
#ifndef _AEGISUB_ENDIAN_H
/// DOCME
#define _AEGISUB_ENDIAN_H
@ -48,15 +50,23 @@
// But this is an OS X system building a universal binary
// Apple's GCC defines _BIG_ENDIAN when building for PPC
# ifdef _BIG_ENDIAN
/// DOCME
# define HAVE_BIG_ENDIAN
# else
/// DOCME
# define HAVE_LITTLE_ENDIAN
# endif
/// DOCME
# undef HAVE_DYNAMIC_ENDIAN
# else // !HAVE_UNIVERSAL_ENDIAN
// We aren't building an OS X universal binary
// Use the dynamic endian code
# ifndef HAVE_DYNAMIC_ENDIAN
/// DOCME
# define HAVE_DYNAMIC_ENDIAN
# endif
# endif //HAVE_UNIVERSAL_ENDIAN
@ -73,6 +83,8 @@
#include <stdint.h>
/// DOCME
namespace Endian {
// Unconditionally reverse endianness
@ -80,6 +92,11 @@ namespace Endian {
// These are only defined for unsigned ints,
// Use reinterpret_cast on the values if you need signed values.
/// @brief DOCME
/// @param val
/// @return
///
inline uint16_t Reverse(uint16_t val)
{
return
@ -87,6 +104,11 @@ namespace Endian {
((val & 0xFF00) >> 8);
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint32_t Reverse(uint32_t val)
{
return
@ -96,6 +118,11 @@ namespace Endian {
((val & 0xFF000000) >> 24);
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint64_t Reverse(uint64_t val)
{
return
@ -116,6 +143,11 @@ namespace Endian {
// Regular, fast, templatized conditional reversing
template <class T>
/// @brief DOCME
/// @param val
/// @return
///
inline T LittleToMachine(T val)
{
#ifdef HAVE_BIG_ENDIAN
@ -128,6 +160,11 @@ namespace Endian {
}
template <class T>
/// @brief DOCME
/// @param val
/// @return
///
inline T BigToMachine(T val)
{
#ifdef HAVE_LITTLE_ENDIAN
@ -140,6 +177,11 @@ namespace Endian {
}
template <class T>
/// @brief DOCME
/// @param val
/// @return
///
inline T MachineToLittle(T val)
{
#ifdef HAVE_BIG_ENDIAN
@ -152,6 +194,11 @@ namespace Endian {
}
template <class T>
/// @brief DOCME
/// @param val
/// @return
///
inline T MachineToBig(T val)
{
#ifdef HAVE_LITTLE_ENDIAN
@ -179,22 +226,45 @@ namespace Endian {
// Unions to pack together ints and get their physical bytes
/// DOCME
union bytes16 {
/// DOCME
uint8_t byte[2];
/// DOCME
uint16_t word;
};
/// DOCME
union bytes32 {
/// DOCME
uint8_t byte[4];
/// DOCME
uint32_t word;
};
/// DOCME
union bytes64 {
/// DOCME
uint8_t byte[8];
/// DOCME
uint64_t word;
};
// 16 bit words
/// @brief DOCME
/// @param val
/// @return
///
inline uint16_t MachineToBig(uint16_t val)
{
bytes16 pack;
@ -205,6 +275,11 @@ namespace Endian {
return pack.word;
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint16_t MachineToLittle(uint16_t val)
{
bytes16 pack;
@ -215,6 +290,11 @@ namespace Endian {
return pack.word;
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint16_t BigToMachine(uint16_t val)
{
bytes16 pack;
@ -224,6 +304,11 @@ namespace Endian {
return uint16_t(pack.byte[1]) | (uint16_t(pack.byte[0]) << 8);
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint16_t LittleToMachine(uint16_t val)
{
bytes16 pack;
@ -236,6 +321,11 @@ namespace Endian {
// 32 bit words
/// @brief DOCME
/// @param val
/// @return
///
inline uint32_t MachineToBig(uint32_t val)
{
bytes32 pack;
@ -246,6 +336,11 @@ namespace Endian {
return pack.word;
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint32_t MachineToLittle(uint32_t val)
{
bytes32 pack;
@ -256,6 +351,11 @@ namespace Endian {
return pack.word;
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint32_t BigToMachine(uint32_t val)
{
bytes32 pack;
@ -267,6 +367,11 @@ namespace Endian {
uint32_t(pack.byte[3]);
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint32_t LittleToMachine(uint32_t val)
{
bytes32 pack;
@ -281,6 +386,11 @@ namespace Endian {
// 64 bit words
/// @brief DOCME
/// @param val
/// @return
///
inline uint64_t MachineToBig(uint64_t val)
{
bytes64 pack;
@ -295,6 +405,11 @@ namespace Endian {
return pack.word;
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint64_t MachineToLittle(uint64_t val)
{
bytes64 pack;
@ -309,6 +424,11 @@ namespace Endian {
return pack.word;
}
/// @brief DOCME
/// @param val
/// @return
///
inline uint64_t BigToMachine(uint64_t val)
{
bytes64 pack;
@ -324,6 +444,10 @@ namespace Endian {
uint64_t(pack.byte[7]);
}
/// @brief DOCME
/// @param val
///
inline uint64_t LittleToMachine(uint64_t val)
{
bytes64 pack;
@ -346,3 +470,4 @@ namespace Endian {
#endif

View file

@ -49,19 +49,25 @@
#include "standard_paths.h"
#include <wx/stdpaths.h>
///////////////
// Constructor
/// @brief Constructor
///
AegisubLocale::AegisubLocale () {
locale = NULL;
curCode = -1;
}
/// @brief DOCME
///
AegisubLocale::~AegisubLocale() {
delete locale;
}
//////////////
// Initialize
/// @brief Initialize
/// @param language
///
void AegisubLocale::Init(int language) {
if (language == -1) language = wxLANGUAGE_ENGLISH;
if (locale) delete locale;
@ -86,8 +92,10 @@ void AegisubLocale::Init(int language) {
}
///////////////////
// Pick a language
/// @brief Pick a language
/// @return
///
int AegisubLocale::PickLanguage() {
// Get list
wxArrayInt langs = GetAvailableLanguages();
@ -120,8 +128,9 @@ int AegisubLocale::PickLanguage() {
}
///////////////////////////////////
// Get list of available languages
/// @brief Get list of available languages
///
wxArrayInt AegisubLocale::GetAvailableLanguages() {
wxArrayInt final;
@ -177,3 +186,4 @@ wxArrayInt AegisubLocale::GetAvailableLanguages() {
return final;
}

View file

@ -35,6 +35,8 @@
///
#ifndef LOCALE_H
/// DOCME
#define LOCALE_H
@ -43,14 +45,22 @@
class wxLocale;
////////////////////////
// Aegisub locale class
/// DOCME
/// @class AegisubLocale
/// @brief DOCME
///
/// DOCME
class AegisubLocale {
private:
/// DOCME
wxLocale *locale;
wxArrayInt GetAvailableLanguages();
public:
/// DOCME
int curCode;
AegisubLocale();
@ -62,3 +72,4 @@ public:
#endif

View file

@ -44,8 +44,10 @@
#include "ass_attachment.h"
///////////////
// Constructor
/// @brief Constructor
/// @param _name
///
AssAttachment::AssAttachment(wxString _name) {
// Parse name
filename = _name;
@ -63,14 +65,17 @@ AssAttachment::AssAttachment(wxString _name) {
}
//////////////
// Destructor
/// @brief Destructor
///
AssAttachment::~AssAttachment() {
}
/////////
// Clone
/// @brief Clone
/// @return
///
AssEntry *AssAttachment::Clone() {
// New object
AssAttachment *clone = new AssAttachment(filename);
@ -83,29 +88,36 @@ AssEntry *AssAttachment::Clone() {
}
////////////
// Get data
/// @brief Get data
/// @return
///
const DataVec &AssAttachment::GetData() {
return data->GetData();
}
/////////////////
// Add more data
/// @brief Add more data
/// @param _data
///
void AssAttachment::AddData(wxString _data) {
data->AddData(_data);
}
//////////////////////
// Finish adding data
/// @brief Finish adding data
///
void AssAttachment::Finish() {
data->Finish();
}
/////////////////////////////////////
// Get encoded data to write on file
/// @brief Get encoded data to write on file
/// @return
///
const wxString AssAttachment::GetEntryData() {
// Get data
const DataVec &dat = data->GetData();
@ -162,8 +174,11 @@ const wxString AssAttachment::GetEntryData() {
}
/////////////////////
// Extract as a file
/// @brief Extract as a file
/// @param filename
/// @return
///
void AssAttachment::Extract(wxString filename) {
// Open file
wxFileOutputStream fp(filename);
@ -172,8 +187,10 @@ void AssAttachment::Extract(wxString filename) {
}
/////////////////////////////
// Read a file as attachment
/// @brief Read a file as attachment
/// @param filename
///
void AssAttachment::Import(wxString filename) {
// Data
DataVec &datavec = data->GetData();
@ -190,8 +207,11 @@ void AssAttachment::Import(wxString filename) {
}
////////////////
// Get filename
/// @brief Get filename
/// @param raw
/// @return
///
wxString AssAttachment::GetFileName(bool raw) {
// Raw
if (raw || filename.Right(4).Lower() != _T(".ttf")) return filename;
@ -212,35 +232,41 @@ wxString AssAttachment::GetFileName(bool raw) {
/////////////////// Attachment //////////////////
///////////////
// Constructor
/// @brief Constructor Attachment //////////////////
///
AttachData::AttachData() {
}
//////////////
// Destructor
/// @brief Destructor
///
AttachData::~AttachData() {
}
////////////
// Get data
/// @brief Get data
/// @return
///
DataVec &AttachData::GetData() {
return data;
}
////////////
// Add data
/// @brief Add data
/// @param data
///
void AttachData::AddData(wxString data) {
buffer += data;
}
//////////
// Finish
/// @brief Finish
///
void AttachData::Finish() {
// Source and dest buffers
unsigned char src[4];
@ -289,3 +315,4 @@ void AttachData::Finish() {
buffer.Shrink();
}

View file

@ -45,16 +45,24 @@
#include <vector>
///////////
// Typedef
/// DOCME
typedef std::vector<unsigned char> DataVec;
///////////////////
// Attachment data
/// DOCME
/// @class AttachData
/// @brief DOCME
///
/// DOCME
class AttachData {
private:
/// DOCME
DataVec data;
/// DOCME
wxString buffer;
public:
@ -67,11 +75,19 @@ public:
};
//////////////////////////////
// Class to store attachments
/// DOCME
/// @class AssAttachment
/// @brief DOCME
///
/// DOCME
class AssAttachment : public AssEntry {
private:
/// DOCME
boost::shared_ptr<AttachData> data;
/// DOCME
wxString filename;
public:
@ -85,6 +101,9 @@ public:
wxString GetFileName(bool raw=false);
const wxString GetEntryData();
/// @brief DOCME
///
ASS_EntryType GetType() { return ENTRY_ATTACHMENT; }
AssEntry *Clone();
@ -92,3 +111,4 @@ public:
~AssAttachment();
};

View file

@ -48,8 +48,9 @@
#include "utils.h"
////////////////////// AssDialogue //////////////////////
// Constructs AssDialogue
/// @brief Constructs AssDialogue AssDialogue //////////////////////
///
AssDialogue::AssDialogue() {
group = _T("[Events]");
@ -68,6 +69,11 @@ AssDialogue::AssDialogue() {
}
/// @brief DOCME
/// @param _data
/// @param version
///
AssDialogue::AssDialogue(wxString _data,int version) {
// Set group
group = _T("[Events]");
@ -92,22 +98,25 @@ AssDialogue::AssDialogue(wxString _data,int version) {
}
//////////////
// Destructor
/// @brief Destructor
///
AssDialogue::~AssDialogue () {
Clear();
}
/////////
// Clear
/// @brief Clear
///
void AssDialogue::Clear () {
ClearBlocks();
}
////////////////
// Clear blocks
/// @brief Clear blocks
///
void AssDialogue::ClearBlocks() {
using std::vector;
for (vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) {
@ -117,8 +126,12 @@ void AssDialogue::ClearBlocks() {
}
//////////////////
// Parse ASS Data
/// @brief Parse ASS Data
/// @param rawData
/// @param version
/// @return
///
bool AssDialogue::Parse(wxString rawData, int version) {
size_t pos = 0;
wxString temp;
@ -213,8 +226,10 @@ bool AssDialogue::Parse(wxString rawData, int version) {
}
/////////////
// Make data
/// @brief Make data
/// @return
///
wxString AssDialogue::MakeData() {
// Prepare
static wxString final = _T("");
@ -254,27 +269,34 @@ wxString AssDialogue::MakeData() {
}
//////////////////////////////////
// Update AssDialogue's data line
/// @brief Update AssDialogue's data line
///
void AssDialogue::UpdateData () {
}
//////////////////
// Get entry data
/// @brief Get entry data
/// @return
///
const wxString AssDialogue::GetEntryData() {
return MakeData();
}
//////////////////
// Set entry data
/// @brief Set entry data
/// @param newData
///
void AssDialogue::SetEntryData(wxString newData) {
}
///////////////////////////////
// Get SSA version of Dialogue
/// @brief Get SSA version of Dialogue
/// @return
///
wxString AssDialogue::GetSSAText () {
// Prepare
wxString work = _T("");
@ -308,10 +330,9 @@ wxString AssDialogue::GetSSAText () {
}
//////////////////
// Parse SRT tags
// --------------
// Yea, I convert to ASS tags, then parse that. So sue me.
/// @brief Yea, I convert to ASS tags, then parse that. So sue me. -------------- Parse SRT tags
///
void AssDialogue::ParseSRTTags () {
// Search and replace
size_t total = 0;
@ -448,8 +469,9 @@ void AssDialogue::ParseSRTTags () {
}
//////////////////
// Parse ASS tags
/// @brief Parse ASS tags
///
void AssDialogue::ParseASSTags () {
// Clear blocks
ClearBlocks();
@ -544,16 +566,19 @@ void AssDialogue::ParseASSTags () {
}
//////////////
// Strip tags
/// @brief Strip tags
///
void AssDialogue::StripTags () {
static wxRegEx reg(_T("\\{[^\\{]*\\}"),wxRE_ADVANCED);
reg.Replace(&Text,_T(""));
}
////////////////////////
// Strip a specific tag
/// @brief Strip a specific tag
/// @param tagName
///
void AssDialogue::StripTag (wxString tagName) {
// Parse
using std::list;
@ -583,11 +608,9 @@ void AssDialogue::StripTag (wxString tagName) {
}
///////////////////////
// Convert tags to SRT
// -------------------
// TODO: Improve this code
//
/// @brief TODO: Improve this code ------------------- Convert tags to SRT
///
void AssDialogue::ConvertTagsToSRT () {
// Setup
using std::list;
@ -688,8 +711,9 @@ void AssDialogue::ConvertTagsToSRT () {
}
//////////////////////////
// Updates text from tags
/// @brief Updates text from tags
///
void AssDialogue::UpdateText () {
using std::vector;
Text = _T("");
@ -704,8 +728,11 @@ void AssDialogue::UpdateText () {
}
/////////////////////////////
// Sets margin from a string
/// @brief Sets margin from a string
/// @param origvalue
/// @param which
///
void AssDialogue::SetMarginString(const wxString origvalue,int which) {
// Make it numeric
wxString strvalue = origvalue;
@ -732,8 +759,12 @@ void AssDialogue::SetMarginString(const wxString origvalue,int which) {
}
//////////////////////////
// Gets string for margin
/// @brief Gets string for margin
/// @param which
/// @param pad
/// @return
///
wxString AssDialogue::GetMarginString(int which,bool pad) {
if (which < 0 || which >= 4) throw new Aegisub::InvalidMarginIdError;
int value = Margin[which];
@ -742,8 +773,14 @@ wxString AssDialogue::GetMarginString(int which,bool pad) {
}
///////////////////////////////////
// Process parameters via callback
/// @brief Process parameters via callback
/// @param tagName
/// @param par_n
/// @param param
/// @param userData)
/// @param userData
///
void AssDialogue::ProcessParameters(void (*callback)(wxString tagName,int par_n,AssOverrideParameter *param,void *userData),void *userData) {
// Apply for all override blocks
AssDialogueBlockOverride *curBlock;
@ -758,8 +795,11 @@ void AssDialogue::ProcessParameters(void (*callback)(wxString tagName,int par_n,
}
///////////////////////////////
// Checks if two lines collide
/// @brief Checks if two lines collide
/// @param target
/// @return
///
bool AssDialogue::CollidesWith(AssDialogue *target) {
if (!target) return false;
int a = Start.GetMS();
@ -770,8 +810,10 @@ bool AssDialogue::CollidesWith(AssDialogue *target) {
}
////////////////////////
// Return just the text without any overrides
/// @brief Return just the text without any overrides
/// @return
///
wxString AssDialogue::GetStrippedText() const {
wxString justtext = wxString(_T(""));
bool inCode = false;
@ -783,8 +825,10 @@ wxString AssDialogue::GetStrippedText() const {
}
return justtext;
}
/////////
// Clone
/// @brief Clone
/// @return
///
AssEntry *AssDialogue::Clone() const {
// Create clone
AssDialogue *final = new AssDialogue();
@ -808,23 +852,26 @@ AssEntry *AssDialogue::Clone() const {
}
////////////////////// AssDialogueBlock //////////////////////
///////////////
// Constructor
/// @brief Constructor AssDialogueBlock //////////////////////
///
AssDialogueBlock::AssDialogueBlock () {
}
//////////////
// Destructor
/// @brief Destructor
/// @return
///
AssDialogueBlock::~AssDialogueBlock () {
}
////////////////////////////
// Returns as a plain block
// ----------------------
// If it isn't a plain block, returns NULL
/// @brief If it isn't a plain block, returns NULL ---------------------- Returns as a plain block
/// @param base
/// @return
///
AssDialogueBlockPlain *AssDialogueBlock::GetAsPlain(AssDialogueBlock *base) {
if (!base) return NULL;
if (base->GetType() == BLOCK_PLAIN) {
@ -834,10 +881,11 @@ AssDialogueBlockPlain *AssDialogueBlock::GetAsPlain(AssDialogueBlock *base) {
}
////////////////////////////////
// Returns as an override block
// ----------------------------
// If it isn't an override block, returns NULL
/// @brief If it isn't an override block, returns NULL ---------------------------- Returns as an override block
/// @param base
/// @return
///
AssDialogueBlockOverride *AssDialogueBlock::GetAsOverride(AssDialogueBlock *base) {
if (!base) return NULL;
if (base->GetType() == BLOCK_OVERRIDE) {
@ -847,10 +895,11 @@ AssDialogueBlockOverride *AssDialogueBlock::GetAsOverride(AssDialogueBlock *base
}
//////////////////////////////
// Returns as a drawing block
// ----------------------------
// If it isn't an drawing block, returns NULL
/// @brief If it isn't an drawing block, returns NULL ---------------------------- Returns as a drawing block
/// @param base
/// @return
///
AssDialogueBlockDrawing *AssDialogueBlock::GetAsDrawing(AssDialogueBlock *base) {
if (!base) return NULL;
if (base->GetType() == BLOCK_DRAWING) {
@ -860,22 +909,27 @@ AssDialogueBlockDrawing *AssDialogueBlock::GetAsDrawing(AssDialogueBlock *base)
}
////////////////////// AssDialogueBlockPlain //////////////////////
///////////////
// Constructor
/// @brief Constructor AssDialogueBlockPlain //////////////////////
///
AssDialogueBlockPlain::AssDialogueBlockPlain () {
}
////////////////////// AssDialogueBlockDrawing //////////////////////
///////////////
// Constructor
/// @brief Constructor AssDialogueBlockDrawing //////////////////////
///
AssDialogueBlockDrawing::AssDialogueBlockDrawing () {
}
////////////////////////
// Multiply coordinates
/// @brief Multiply coordinates
/// @param mx
/// @param my
/// @param x
/// @param y
///
void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) {
// HACK: Implement a proper parser ffs!!
wxStringTokenizer tkn(GetText(),_T(" "),wxTOKEN_DEFAULT);
@ -917,3 +971,4 @@ void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) {

View file

@ -54,45 +54,63 @@ class AssDialogueBlockOverride;
class AssDialogueBlockDrawing;
///////////////////
// Block type enum
/// DOCME
enum ASS_BlockType {
/// DOCME
BLOCK_BASE,
/// DOCME
BLOCK_PLAIN,
/// DOCME
BLOCK_OVERRIDE,
/// DOCME
BLOCK_DRAWING
};
//////////////////////
// AssDialogue Blocks
// ------------------
// A block is each group in the text field of an AssDialogue
// For example:
// Yes, I {\i1}am{\i0} here.
//
// Gets split in five blocks:
// "Yes, I " (Plain)
// "\i1" (Override)
// "am" (Plain)
// "\i0" (Override)
// " here." (Plain)
//
// Also note how {}s are discarded.
// Override blocks are further divided in AssOverrideTag's.
//
// The GetText() method generates a new value for the "text" field from
// the other fields in the specific class, and returns the new value.
//
/// DOCME
/// @class AssDialogueBlock
/// @brief AssDialogue Blocks
///
/// A block is each group in the text field of an AssDialogue
/// @verbatium
/// Yes, I {\i1}am{\i0} here.
///
/// Gets split in five blocks:
/// "Yes, I " (Plain)
/// "\i1" (Override)
/// "am" (Plain)
/// "\i0" (Override)
/// " here." (Plain)
///
/// Also note how {}s are discarded.
/// Override blocks are further divided in AssOverrideTag's.
///
/// The GetText() method generates a new value for the "text" field from
/// the other fields in the specific class, and returns the new value.
/// @endverbatium
class AssDialogueBlock {
public:
/// DOCME
wxString text;
/// DOCME
AssDialogue *parent;
AssDialogueBlock();
virtual ~AssDialogueBlock();
virtual ASS_BlockType GetType() = 0;
/// @brief DOCME
/// @return
///
virtual wxString GetText() { return text; }
static AssDialogueBlockPlain *GetAsPlain(AssDialogueBlock *base); // Returns a block base as a plain block if it is valid, null otherwise
static AssDialogueBlockOverride *GetAsOverride(AssDialogueBlock *base); // Returns a block base as an override block if it is valid, null otherwise
@ -100,47 +118,64 @@ public:
};
/////////////////////////////
// Plain dialogue block text
// -------------------------
// This is used for standard text
// type = BLOCK_PLAIN
//
/// DOCME
/// @class AssDialogueBlockPlain
/// @brief DOCME
///
/// DOCME
class AssDialogueBlockPlain : public AssDialogueBlock {
public:
/// @brief DOCME
/// @return
///
ASS_BlockType GetType() { return BLOCK_PLAIN; }
AssDialogueBlockPlain();
};
/////////////////////////////
// Plain dialogue block text
// -------------------------
// This is used for drawing commands
// type = BLOCK_DRAWING
//
/// DOCME
/// @class AssDialogueBlockDrawing
/// @brief DOCME
///
/// DOCME
class AssDialogueBlockDrawing : public AssDialogueBlock {
public:
/// DOCME
int Scale;
/// @brief DOCME
/// @return
///
ASS_BlockType GetType() { return BLOCK_DRAWING; }
AssDialogueBlockDrawing();
void TransformCoords(int trans_x,int trans_y,double mult_x,double mult_y);
};
//////////////////////
// Override tag block
// ------------------
// Used to store ASS overrides
// Type = BLOCK_OVERRIDE
//
/// DOCME
/// @class AssDialogueBlockOverride
/// @brief DOCME
///
/// DOCME
class AssDialogueBlockOverride : public AssDialogueBlock {
public:
AssDialogueBlockOverride();
~AssDialogueBlockOverride();
/// DOCME
std::vector<AssOverrideTag*> Tags;
/// @brief DOCME
/// @return
///
ASS_BlockType GetType() { return BLOCK_OVERRIDE; }
wxString GetText();
void ParseTags(); // Parses tags
@ -148,25 +183,53 @@ public:
};
////////////////////////////////////////
// Class for Dialogue and Comment lines
/// DOCME
/// @class AssDialogue
/// @brief DOCME
///
/// DOCME
class AssDialogue : public AssEntry {
private:
wxString MakeData();
public:
/// DOCME
std::vector<AssDialogueBlock*> Blocks; // Contains information about each block of text
/// DOCME
bool Comment; // Is this a comment line?
/// DOCME
int Layer; // Layer number
/// DOCME
int Margin[4]; // Margins: 0 = Left, 1 = Right, 2 = Top (Vertical), 3 = Bottom
/// DOCME
AssTime Start; // Starting time
/// DOCME
AssTime End; // Ending time
/// DOCME
wxString Style; // Style name
/// DOCME
wxString Actor; // Actor name
/// DOCME
wxString Effect; // Effect name
/// DOCME
wxString Text; // Raw text data
/// @brief DOCME
/// @return
///
ASS_EntryType GetType() { return ENTRY_DIALOGUE; }
bool Parse(wxString data,int version=1); // Parses raw ASS data into everything else
@ -186,10 +249,29 @@ public:
void SetEntryData(wxString newData);
void Clear(); // Wipes all data
/// @brief DOCME
/// @return
///
virtual int GetStartMS() const { return Start.GetMS(); }
/// @brief DOCME
/// @return
///
virtual int GetEndMS() const { return End.GetMS(); }
/// @brief DOCME
/// @param newStart
///
virtual void SetStartMS(const int newStart) { AssEntry::SetStartMS(newStart); Start.SetMS(newStart); }
/// @brief DOCME
/// @param newEnd
///
virtual void SetEndMS(const int newEnd) { End.SetMS(newEnd); }
/// @brief DOCME
///
void FixStartMS() { AssEntry::SetStartMS(Start.GetMS()); } // Update StartMS in AssEntry from the Start value here
void SetMarginString(const wxString value,int which); // Set string to a margin value (0 = left, 1 = right, 2 = vertical/top, 3 = bottom)
@ -204,3 +286,4 @@ public:
~AssDialogue();
};

View file

@ -45,34 +45,46 @@
#include "ass_entry.h"
////////////////////// AssEntry //////////////////////
///////////////////////
// Constructs AssEntry
/// @brief Constructs AssEntry AssEntry //////////////////////
///
AssEntry::AssEntry() {
Valid = true;
}
/// @brief DOCME
/// @param _data
///
AssEntry::AssEntry(wxString _data) {
data = _data;
Valid = true;
}
///////////////////////////
// Destructor for AssEntry
/// @brief Destructor for AssEntry
///
AssEntry::~AssEntry() {
}
///////////////////////////
// Comparison for STL Sort
/// @brief Comparison for STL Sort
/// @param t1
/// @param t2
/// @return
///
bool operator < (const AssEntry &t1, const AssEntry &t2) {
return (t1.GetStartMS() < t2.GetStartMS());
}
////////////////////////////////////////////////////////////////
// Returns an entry as dialogue if possible, else, returns NULL
/// @brief Returns an entry as dialogue if possible, else, returns NULL
/// @param base
/// @return
///
AssDialogue *AssEntry::GetAsDialogue(AssEntry *base) {
if (!base) return NULL;
if (base->GetType() == ENTRY_DIALOGUE) {
@ -82,8 +94,11 @@ AssDialogue *AssEntry::GetAsDialogue(AssEntry *base) {
}
/////////////////////////////////////////////////////////////
// Returns an entry as style if possible, else, returns NULL
/// @brief Returns an entry as style if possible, else, returns NULL
/// @param base
/// @return
///
AssStyle *AssEntry::GetAsStyle(AssEntry *base) {
if (!base) return NULL;
if (base->GetType() == ENTRY_STYLE) {
@ -93,8 +108,11 @@ AssStyle *AssEntry::GetAsStyle(AssEntry *base) {
}
///////////////////////////////////////////////////////////////////
// Returns an entry as attachment if possible, else, returns NULL
/// @brief Returns an entry as attachment if possible, else, returns NULL
/// @param base
/// @return
///
AssAttachment *AssEntry::GetAsAttachment(AssEntry *base) {
if (!base) return NULL;
if (base->GetType() == ENTRY_ATTACHMENT) {
@ -104,8 +122,10 @@ AssAttachment *AssEntry::GetAsAttachment(AssEntry *base) {
}
//////////////////////
// Get SSA conversion
/// @brief Get SSA conversion
/// @return
///
wxString AssEntry::GetSSAText() {
// Special cases
if (data.Lower() == _T("[v4+ styles]")) return wxString(_T("[V4 Styles]"));
@ -118,8 +138,9 @@ wxString AssEntry::GetSSAText() {
}
/////////
// Clone
/// @brief Clone
///
AssEntry *AssEntry::Clone() const {
// Create clone
AssEntry *final = new AssEntry();
@ -134,3 +155,4 @@ AssEntry *AssEntry::Clone() const {
return final;
}

View file

@ -52,36 +52,70 @@ class AssStyle;
class AssAttachment;
///////////////////
// Entry type enum
/// DOCME
enum ASS_EntryType {
/// DOCME
ENTRY_BASE,
/// DOCME
ENTRY_DIALOGUE,
/// DOCME
ENTRY_STYLE,
/// DOCME
ENTRY_ATTACHMENT
};
/// DOCME
namespace Aegisub {
// Thrown when someone supplies an invalid margin ID to a function expecting one
// (Usually limited to range 0..3.)
/// DOCME
/// @class InvalidMarginIdError
/// @brief DOCME
///
/// DOCME
class InvalidMarginIdError : public InternalError {
public:
/// @brief DOCME
/// @return
///
InvalidMarginIdError() : InternalError(_T("Invalid margin id"), 0) { }
/// @brief DOCME
/// @return
///
const wxChar *GetName() { return _T("internal_error/invalid_margin_id"); }
};
};
////////////////////////////////////
// Base class for each line in file
/// DOCME
/// @class AssEntry
/// @brief DOCME
///
/// DOCME
class AssEntry {
private: