Moved out AbstractBlock implementation from header file.
This commit is contained in:
parent
c06f0435c4
commit
8aeb6def88
2 changed files with 57 additions and 31 deletions
|
|
@ -340,6 +340,53 @@ bool BlockParser::isLineBreak(
|
|||
return lineBreak;
|
||||
}
|
||||
|
||||
AbstractBlock::AbstractBlock(
|
||||
const style::font &font,
|
||||
const QString &str,
|
||||
uint16 from,
|
||||
uint16 length,
|
||||
uchar flags,
|
||||
uint16 lnkIndex)
|
||||
: _from(from)
|
||||
, _flags((flags & 0xFF) | ((lnkIndex & 0xFFFF) << 12)) {
|
||||
}
|
||||
|
||||
uint16 AbstractBlock::from() const {
|
||||
return _from;
|
||||
}
|
||||
|
||||
int AbstractBlock::width() const {
|
||||
return _width.toInt();
|
||||
}
|
||||
|
||||
int AbstractBlock::rpadding() const {
|
||||
return _rpadding.toInt();
|
||||
}
|
||||
|
||||
QFixed AbstractBlock::f_width() const {
|
||||
return _width;
|
||||
}
|
||||
|
||||
QFixed AbstractBlock::f_rpadding() const {
|
||||
return _rpadding;
|
||||
}
|
||||
|
||||
uint16 AbstractBlock::lnkIndex() const {
|
||||
return (_flags >> 12) & 0xFFFF;
|
||||
}
|
||||
|
||||
void AbstractBlock::setLnkIndex(uint16 lnkIndex) {
|
||||
_flags = (_flags & ~(0xFFFF << 12)) | (lnkIndex << 12);
|
||||
}
|
||||
|
||||
TextBlockType AbstractBlock::type() const {
|
||||
return TextBlockType((_flags >> 8) & 0x0F);
|
||||
}
|
||||
|
||||
int32 AbstractBlock::flags() const {
|
||||
return (_flags & 0xFF);
|
||||
}
|
||||
|
||||
QFixed AbstractBlock::f_rbearing() const {
|
||||
return (type() == TextBlockTText)
|
||||
? static_cast<const TextBlock*>(this)->real_f_rbearing()
|
||||
|
|
|
|||
|
|
@ -34,38 +34,20 @@ enum TextBlockFlags {
|
|||
|
||||
class AbstractBlock {
|
||||
public:
|
||||
uint16 from() const {
|
||||
return _from;
|
||||
}
|
||||
int width() const {
|
||||
return _width.toInt();
|
||||
}
|
||||
int rpadding() const {
|
||||
return _rpadding.toInt();
|
||||
}
|
||||
QFixed f_width() const {
|
||||
return _width;
|
||||
}
|
||||
QFixed f_rpadding() const {
|
||||
return _rpadding;
|
||||
}
|
||||
uint16 from() const;
|
||||
int width() const;
|
||||
int rpadding() const;
|
||||
QFixed f_width() const;
|
||||
QFixed f_rpadding() const;
|
||||
|
||||
// Should be virtual, but optimized throught type() call.
|
||||
QFixed f_rbearing() const;
|
||||
|
||||
uint16 lnkIndex() const {
|
||||
return (_flags >> 12) & 0xFFFF;
|
||||
}
|
||||
void setLnkIndex(uint16 lnkIndex) {
|
||||
_flags = (_flags & ~(0xFFFF << 12)) | (lnkIndex << 12);
|
||||
}
|
||||
uint16 lnkIndex() const;
|
||||
void setLnkIndex(uint16 lnkIndex);
|
||||
|
||||
TextBlockType type() const {
|
||||
return TextBlockType((_flags >> 8) & 0x0F);
|
||||
}
|
||||
int32 flags() const {
|
||||
return (_flags & 0xFF);
|
||||
}
|
||||
TextBlockType type() const;
|
||||
int32 flags() const;
|
||||
|
||||
protected:
|
||||
AbstractBlock(
|
||||
|
|
@ -74,10 +56,7 @@ protected:
|
|||
uint16 from,
|
||||
uint16 length,
|
||||
uchar flags,
|
||||
uint16 lnkIndex)
|
||||
: _from(from)
|
||||
, _flags((flags & 0xFF) | ((lnkIndex & 0xFFFF) << 12)) {
|
||||
}
|
||||
uint16 lnkIndex);
|
||||
|
||||
uint16 _from = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue