libmwaw_applepict1::OpCode Struct Reference

Internal and low level: a class to define each opcode and their arguments and read their data. More...

Public Member Functions

 OpCode (int id, char const *nm, DataType type1=WP_NONE, DataType type2=WP_NONE, DataType type3=WP_NONE, DataType type4=WP_NONE, DataType type5=WP_NONE)
 constructor
 
 OpCode (OpCode const &)=default
 
virtual ~OpCode ()
 
bool readData (MWAWInputStream &input, std::vector< Value > &listValue) const
 tries to read the data in the file
 
bool computeSize (MWAWInputStream &input, int &sz) const
 computes the size of the data
 

Static Public Member Functions

static bool readRect (MWAWInputStream &input, DataType type, MWAWBox2i &res)
 read a rectangles field
 

Public Attributes

int m_id
 the opCode
 
std::string m_name
 the opCode name
 
std::vector< DataTypem_types
 the different argument types
 

Static Protected Member Functions

static int getSize (MWAWInputStream &input, DataType type)
 returns the size of the next argument of type type.
 
static bool readValue (MWAWInputStream &input, DataType type, Value &val)
 reads a argument of type type, if successfull updates val.
 
static bool readInt (MWAWInputStream &input, DataType type, int &res)
 low level: reads a integer ( bytes or 2 bytes, signed or unsigned)
 
static bool readColor (MWAWInputStream &input, DataType type, MWAWColor &col)
 low level: reads a color argument
 
static bool readPattern (MWAWInputStream &input, DataType type, int(&pat)[8])
 low level: reads a pattern argument
 
static bool readPoint (MWAWInputStream &input, DataType type, MWAWVec2i &res)
 low level: reads a point argument
 
static bool readPoly (MWAWInputStream &input, DataType type, MWAWBox2i &box, std::vector< MWAWVec2i > &res)
 low level: reads a polygon argument
 
static bool readText (MWAWInputStream &input, DataType type, std::string &res)
 low level: reads a string argument
 

Detailed Description

Internal and low level: a class to define each opcode and their arguments and read their data.

Constructor & Destructor Documentation

◆ OpCode() [1/2]

libmwaw_applepict1::OpCode::OpCode ( int  id,
char const *  nm,
DataType  type1 = WP_NONE,
DataType  type2 = WP_NONE,
DataType  type3 = WP_NONE,
DataType  type4 = WP_NONE,
DataType  type5 = WP_NONE 
)
inline

constructor

Parameters
idis the code of the opcode in the file
nmis the short name of the opcode
type1type of the first component
type2type of the second component (if it exists)
type3type of the third component (if it exists)
type4type of the fourst component (if it exists)
type5type of the fifth component (if it exists)

◆ OpCode() [2/2]

libmwaw_applepict1::OpCode::OpCode ( OpCode const &  )
default

◆ ~OpCode()

libmwaw_applepict1::OpCode::~OpCode ( )
virtual

Member Function Documentation

◆ computeSize()

bool libmwaw_applepict1::OpCode::computeSize ( MWAWInputStream input,
int &  sz 
) const
inline

computes the size of the data

Referenced by libmwaw_applepict1::PictParser::convertToPict2().

◆ getSize()

static int libmwaw_applepict1::OpCode::getSize ( MWAWInputStream input,
DataType  type 
)
inlinestaticprotected

returns the size of the next argument of type type.

Note
This function can update the next reading position in the input, if it uses the input to compute the size of this argument

Referenced by computeSize().

◆ readColor()

static bool libmwaw_applepict1::OpCode::readColor ( MWAWInputStream input,
DataType  type,
MWAWColor col 
)
inlinestaticprotected

low level: reads a color argument

Note
check if this is not an indexed color

Referenced by readValue().

◆ readData()

bool libmwaw_applepict1::OpCode::readData ( MWAWInputStream input,
std::vector< Value > &  listValue 
) const
inline

tries to read the data in the file

If the read is succefull, fills listValue with the read argument

◆ readInt()

static bool libmwaw_applepict1::OpCode::readInt ( MWAWInputStream input,
DataType  type,
int &  res 
)
inlinestaticprotected

low level: reads a integer ( bytes or 2 bytes, signed or unsigned)

Referenced by readPoint(), readPoly(), readText(), and readValue().

◆ readPattern()

static bool libmwaw_applepict1::OpCode::readPattern ( MWAWInputStream input,
DataType  type,
int(&)  pat[8] 
)
inlinestaticprotected

low level: reads a pattern argument

Referenced by readValue().

◆ readPoint()

static bool libmwaw_applepict1::OpCode::readPoint ( MWAWInputStream input,
DataType  type,
MWAWVec2i res 
)
inlinestaticprotected

low level: reads a point argument

Referenced by readPoly(), readRect(), and readValue().

◆ readPoly()

static bool libmwaw_applepict1::OpCode::readPoly ( MWAWInputStream input,
DataType  type,
MWAWBox2i box,
std::vector< MWAWVec2i > &  res 
)
inlinestaticprotected

low level: reads a polygon argument

Referenced by readValue().

◆ readRect()

static bool libmwaw_applepict1::OpCode::readRect ( MWAWInputStream input,
DataType  type,
MWAWBox2i res 
)
inlinestatic

read a rectangles field

Note
can be used to read the first dimensions of a picture

Referenced by readPoly(), and readValue().

◆ readText()

static bool libmwaw_applepict1::OpCode::readText ( MWAWInputStream input,
DataType  type,
std::string &  res 
)
inlinestaticprotected

low level: reads a string argument

Referenced by readValue().

◆ readValue()

static bool libmwaw_applepict1::OpCode::readValue ( MWAWInputStream input,
DataType  type,
Value val 
)
inlinestaticprotected

reads a argument of type type, if successfull updates val.

Referenced by readData().

Member Data Documentation

◆ m_id

int libmwaw_applepict1::OpCode::m_id

the opCode

◆ m_name

std::string libmwaw_applepict1::OpCode::m_name

the opCode name

◆ m_types

std::vector<DataType> libmwaw_applepict1::OpCode::m_types

the different argument types

Referenced by computeSize(), OpCode(), and readData().


The documentation for this struct was generated from the following file:

Generated on Wed May 3 2023 07:18:29 for libmwaw by doxygen 1.9.6