2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, 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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file ass_override.h
|
|
|
|
/// @see ass_override.cpp
|
|
|
|
/// @ingroup subs_storage
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2009-09-11 04:36:34 +02:00
|
|
|
#ifndef AGI_PRE
|
2006-01-16 22:02:54 +01:00
|
|
|
#include <vector>
|
2009-09-11 04:36:34 +02:00
|
|
|
#endif
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "variable_data.h"
|
|
|
|
|
2010-06-24 03:24:43 +02:00
|
|
|
/// Type of parameter; probably only used by the resample tool
|
2006-01-16 22:02:54 +01:00
|
|
|
enum ASS_ParameterClass {
|
|
|
|
PARCLASS_NORMAL,
|
|
|
|
PARCLASS_ABSOLUTE_SIZE,
|
|
|
|
PARCLASS_ABSOLUTE_POS_X,
|
|
|
|
PARCLASS_ABSOLUTE_POS_Y,
|
|
|
|
PARCLASS_RELATIVE_SIZE_X,
|
|
|
|
PARCLASS_RELATIVE_SIZE_Y,
|
|
|
|
PARCLASS_RELATIVE_TIME_START,
|
|
|
|
PARCLASS_RELATIVE_TIME_END,
|
|
|
|
PARCLASS_KARAOKE,
|
|
|
|
PARCLASS_DRAWING
|
|
|
|
};
|
|
|
|
|
2010-06-24 03:24:43 +02:00
|
|
|
/// The parameter is absent unless the total number of parameters is the
|
|
|
|
/// indicated number. Note that only arguments not at the end need to be marked
|
|
|
|
/// as optional; this is just to know which parameters to skip when there are
|
|
|
|
/// earlier optional arguments
|
2006-01-16 22:02:54 +01:00
|
|
|
enum ASS_ParameterOptional {
|
|
|
|
NOT_OPTIONAL = 0xFF,
|
|
|
|
OPTIONAL_1 = 0x01,
|
|
|
|
OPTIONAL_2 = 0x02,
|
|
|
|
OPTIONAL_3 = 0x04,
|
|
|
|
OPTIONAL_4 = 0x08,
|
|
|
|
OPTIONAL_5 = 0x10,
|
|
|
|
OPTIONAL_6 = 0x20,
|
|
|
|
OPTIONAL_7 = 0x40
|
|
|
|
};
|
|
|
|
|
2010-06-04 05:07:58 +02:00
|
|
|
/// DOCME
|
|
|
|
/// @class AssOverrideParameter
|
2010-06-24 03:24:43 +02:00
|
|
|
/// @brief A single parameter to an override tag
|
2010-06-04 05:07:58 +02:00
|
|
|
class AssOverrideParameter : public VariableData {
|
|
|
|
public:
|
2010-06-24 03:24:43 +02:00
|
|
|
/// Type of parameter
|
2010-06-04 05:07:58 +02:00
|
|
|
ASS_ParameterClass classification;
|
|
|
|
|
2010-06-24 03:24:43 +02:00
|
|
|
/// Is the parameter's value actually given?
|
|
|
|
bool omitted;
|
2010-06-04 05:07:58 +02:00
|
|
|
|
|
|
|
AssOverrideParameter();
|
2010-06-24 03:24:43 +02:00
|
|
|
AssOverrideParameter(const AssOverrideParameter&);
|
|
|
|
void operator=(const AssOverrideParameter ¶m);
|
2010-06-04 05:07:58 +02:00
|
|
|
};
|
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.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// DOCME
|
|
|
|
/// @class AssOverrideParamProto
|
2010-06-24 03:24:43 +02:00
|
|
|
/// @brief Prototype of a single override parameter
|
|
|
|
struct AssOverrideParamProto {
|
|
|
|
/// ASS_ParameterOptional
|
2006-01-16 22:02:54 +01:00
|
|
|
int optional;
|
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.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-06-24 03:24:43 +02:00
|
|
|
/// Type of this parameter
|
2006-01-16 22:02:54 +01:00
|
|
|
VariableDataType type;
|
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.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-06-24 03:24:43 +02:00
|
|
|
/// Semantic type of this parameter
|
2006-01-16 22:02:54 +01:00
|
|
|
ASS_ParameterClass classification;
|
|
|
|
|
2010-06-24 03:24:43 +02:00
|
|
|
AssOverrideParamProto (VariableDataType type, int opt=NOT_OPTIONAL, ASS_ParameterClass classi=PARCLASS_NORMAL);
|
2006-01-16 22:02:54 +01:00
|
|
|
};
|
|
|
|
|
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.
2009-07-30 00:59:22 +02:00
|
|
|
/// DOCME
|
|
|
|
/// @class AssOverrideTagProto
|
|
|
|
/// @brief DOCME
|
2010-06-24 03:24:43 +02:00
|
|
|
struct AssOverrideTagProto {
|
|
|
|
/// Name of the tag, with slash
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString name;
|
2010-06-24 03:24:43 +02:00
|
|
|
/// Parameters to this tag
|
2006-01-16 22:02:54 +01:00
|
|
|
std::vector<AssOverrideParamProto> params;
|
2010-06-04 05:07:58 +02:00
|
|
|
typedef std::vector<AssOverrideTagProto>::iterator iterator;
|
|
|
|
|
2010-06-24 03:24:43 +02:00
|
|
|
/// @brief Add a parameter to this tag prototype
|
|
|
|
/// @param type Data type of the parameter
|
|
|
|
/// @param classi Semantic type of the parameter
|
|
|
|
/// @param opt Situations in which this parameter is present
|
|
|
|
void AddParam(VariableDataType type, ASS_ParameterClass classi = PARCLASS_NORMAL, int opt = NOT_OPTIONAL);
|
|
|
|
/// @brief Convenience function for single-argument tags
|
|
|
|
/// @param name Name of the tag, with slash
|
|
|
|
/// @param type Data type of the parameter
|
|
|
|
/// @param classi Semantic type of the parameter
|
|
|
|
/// @param opt Situations in which this parameter is present
|
|
|
|
void Set(wxString name, VariableDataType type, ASS_ParameterClass classi = PARCLASS_NORMAL, int opt = NOT_OPTIONAL);
|
2006-01-16 22:02:54 +01:00
|
|
|
};
|
2009-07-29 07:43:02 +02:00
|
|
|
|
2010-06-04 05:07:58 +02:00
|
|
|
/// DOCME
|
|
|
|
/// @class AssOverrideTag
|
|
|
|
/// @brief DOCME
|
|
|
|
///
|
|
|
|
/// DOCME
|
|
|
|
class AssOverrideTag {
|
|
|
|
bool valid;
|
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.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-06-04 05:07:58 +02:00
|
|
|
public:
|
|
|
|
wxString Name;
|
|
|
|
std::vector <AssOverrideParameter*> Params;
|
|
|
|
|
|
|
|
AssOverrideTag();
|
2010-06-24 03:24:43 +02:00
|
|
|
AssOverrideTag(wxString text);
|
2010-06-04 05:07:58 +02:00
|
|
|
~AssOverrideTag();
|
|
|
|
|
|
|
|
bool IsValid();
|
2010-06-24 03:24:43 +02:00
|
|
|
/// @brief Parses the parameters for the ass override tag
|
|
|
|
/// @param text All text between the name and the next \ or the end of the override block
|
2010-06-04 05:07:58 +02:00
|
|
|
void ParseParameters(const wxString &text, AssOverrideTagProto::iterator proto);
|
|
|
|
void Clear();
|
|
|
|
void SetText(const wxString &text);
|
2010-06-24 03:24:43 +02:00
|
|
|
operator wxString();
|
2010-06-04 05:07:58 +02:00
|
|
|
};
|