Kaydet (Commit) bde1e4dc authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: fix indentation in rtfsprm

Change-Id: Id81cb97033e616acf071f386630b49ccb83dfedc
üst 2d786ef2
......@@ -13,8 +13,10 @@
#include <resourcemodel/QNameToString.hxx>
namespace writerfilter {
namespace rtftok {
namespace writerfilter
{
namespace rtftok
{
RTFSprm::RTFSprm(Id nKeyword, RTFValue::Pointer_t& pValue)
: m_nKeyword(nKeyword),
......@@ -156,7 +158,8 @@ void RTFSprms::deduplicate(RTFSprms& rReference)
void RTFSprms::ensureCopyBeforeWrite()
{
if (m_pSprms->m_nRefCount > 1) {
if (m_pSprms->m_nRefCount > 1)
{
boost::intrusive_ptr<RTFSprmsImpl> pClone(new RTFSprmsImpl());
for (std::vector< std::pair<Id, RTFValue::Pointer_t> >::const_iterator i = m_pSprms->begin(); i != m_pSprms->end(); ++i)
pClone->push_back(std::make_pair(i->first, RTFValue::Pointer_t(i->second->Clone())));
......
......@@ -20,40 +20,42 @@
#include <rtfcontrolwords.hxx>
#include <rtfvalue.hxx>
namespace writerfilter {
namespace rtftok {
namespace writerfilter
{
namespace rtftok
{
typedef std::vector< std::pair<Id, RTFValue::Pointer_t> > RTFSprmsImplBase;
typedef std::vector< std::pair<Id, RTFValue::Pointer_t> > RTFSprmsImplBase;
/// The payload of RTFSprms which is only copied on write.
class RTFSprmsImpl : public RTFSprmsImplBase
{
public:
/// The payload of RTFSprms which is only copied on write.
class RTFSprmsImpl : public RTFSprmsImplBase
{
public:
sal_Int32 m_nRefCount;
RTFSprmsImpl() : RTFSprmsImplBase(), m_nRefCount(0) {}
};
};
inline void intrusive_ptr_add_ref(RTFSprmsImpl* p)
{
inline void intrusive_ptr_add_ref(RTFSprmsImpl* p)
{
++(p->m_nRefCount);
}
inline void intrusive_ptr_release(RTFSprmsImpl* p)
{
}
inline void intrusive_ptr_release(RTFSprmsImpl* p)
{
if (!--(p->m_nRefCount))
delete p;
}
}
enum RTFOverwrite
{
enum RTFOverwrite
{
OVERWRITE_YES, ///< Yes, if an existing key is found, overwrite it.
OVERWRITE_NO_APPEND, ///< No, always append the value to the end of the list.
OVERWRITE_NO_IGNORE ///< No, if the key is already in the list, then ignore, otherwise append.
};
};
/// A list of RTFSprm with a copy constructor that performs a deep copy.
class RTFSprms
{
public:
/// A list of RTFSprm with a copy constructor that performs a deep copy.
class RTFSprms
{
public:
typedef ::boost::shared_ptr<RTFSprms> Pointer_t;
typedef std::pair<Id, RTFValue::Pointer_t> Entry_t;
typedef std::vector<Entry_t>::iterator Iterator_t;
......@@ -67,22 +69,37 @@ namespace writerfilter {
bool erase(Id nKeyword);
/// Removes elements, which are already in the reference set.
void deduplicate(RTFSprms& rReference);
size_t size() const { return m_pSprms->size(); }
bool empty() const { return m_pSprms->empty(); }
Entry_t& back() { return m_pSprms->back(); }
Iterator_t begin() { return m_pSprms->begin(); }
Iterator_t end() { return m_pSprms->end(); }
size_t size() const
{
return m_pSprms->size();
}
bool empty() const
{
return m_pSprms->empty();
}
Entry_t& back()
{
return m_pSprms->back();
}
Iterator_t begin()
{
return m_pSprms->begin();
}
Iterator_t end()
{
return m_pSprms->end();
}
void clear();
private:
private:
void ensureCopyBeforeWrite();
boost::intrusive_ptr<RTFSprmsImpl> m_pSprms;
};
};
/// RTF keyword with a parameter
class RTFSprm
/// RTF keyword with a parameter
class RTFSprm
: public Sprm
{
public:
{
public:
RTFSprm(Id nKeyword, RTFValue::Pointer_t& pValue);
virtual ~RTFSprm() {}
virtual sal_uInt32 getId() const SAL_OVERRIDE;
......@@ -93,11 +110,11 @@ namespace writerfilter {
virtual Kind getKind() SAL_OVERRIDE;
virtual std::string getName() const SAL_OVERRIDE;
virtual std::string toString() const SAL_OVERRIDE;
private:
private:
Id m_nKeyword;
RTFValue::Pointer_t& m_pValue;
};
} // namespace rtftok
};
} // namespace rtftok
} // namespace writerfilter
#endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSPRM_HXX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment