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;
|
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 {
|
QFixed AbstractBlock::f_rbearing() const {
|
||||||
return (type() == TextBlockTText)
|
return (type() == TextBlockTText)
|
||||||
? static_cast<const TextBlock*>(this)->real_f_rbearing()
|
? static_cast<const TextBlock*>(this)->real_f_rbearing()
|
||||||
|
|
|
||||||
|
|
@ -34,38 +34,20 @@ enum TextBlockFlags {
|
||||||
|
|
||||||
class AbstractBlock {
|
class AbstractBlock {
|
||||||
public:
|
public:
|
||||||
uint16 from() const {
|
uint16 from() const;
|
||||||
return _from;
|
int width() const;
|
||||||
}
|
int rpadding() const;
|
||||||
int width() const {
|
QFixed f_width() const;
|
||||||
return _width.toInt();
|
QFixed f_rpadding() const;
|
||||||
}
|
|
||||||
int rpadding() const {
|
|
||||||
return _rpadding.toInt();
|
|
||||||
}
|
|
||||||
QFixed f_width() const {
|
|
||||||
return _width;
|
|
||||||
}
|
|
||||||
QFixed f_rpadding() const {
|
|
||||||
return _rpadding;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should be virtual, but optimized throught type() call.
|
// Should be virtual, but optimized throught type() call.
|
||||||
QFixed f_rbearing() const;
|
QFixed f_rbearing() const;
|
||||||
|
|
||||||
uint16 lnkIndex() const {
|
uint16 lnkIndex() const;
|
||||||
return (_flags >> 12) & 0xFFFF;
|
void setLnkIndex(uint16 lnkIndex);
|
||||||
}
|
|
||||||
void setLnkIndex(uint16 lnkIndex) {
|
|
||||||
_flags = (_flags & ~(0xFFFF << 12)) | (lnkIndex << 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextBlockType type() const {
|
TextBlockType type() const;
|
||||||
return TextBlockType((_flags >> 8) & 0x0F);
|
int32 flags() const;
|
||||||
}
|
|
||||||
int32 flags() const {
|
|
||||||
return (_flags & 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AbstractBlock(
|
AbstractBlock(
|
||||||
|
|
@ -74,10 +56,7 @@ protected:
|
||||||
uint16 from,
|
uint16 from,
|
||||||
uint16 length,
|
uint16 length,
|
||||||
uchar flags,
|
uchar flags,
|
||||||
uint16 lnkIndex)
|
uint16 lnkIndex);
|
||||||
: _from(from)
|
|
||||||
, _flags((flags & 0xFF) | ((lnkIndex & 0xFFFF) << 12)) {
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16 _from = 0;
|
uint16 _from = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue