[Patch] Removed inheritance from std vector and std map.

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Apr 8 16:12:33 PDT 2015


Hey,

so this is the wrong format to submit patches.

The preferred way is to use gerrit and follow the instructions at
https://wiki.documentfoundation.org/Development/gerrit

There is still the discouraged way of attaching the result of got
format-patch to a mail but if possible please use gerrit.

Regards,
Markus

On Thu, Apr 9, 2015 at 1:09 AM, Delveri chick <chickdelveri at gmail.com>
wrote:

> diff --git a/idl/inc/basobj.hxx b/idl/inc/basobj.hxx
> index c601fb1..807b861 100644
> --- a/idl/inc/basobj.hxx
> +++ b/idl/inc/basobj.hxx
> @@ -88,8 +88,8 @@ protected:
>      virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
>                                        SvTokenStream & rInStm );
>  public:
> -            TYPEINFO_OVERRIDE();
> -            SvMetaName();
> +    TYPEINFO_OVERRIDE();
> +    SvMetaName();
>
>      virtual bool                SetName( const OString& rName,
> SvIdlDataBase * = NULL  );
>      void                        SetDescription( const OString& rText )
> @@ -113,8 +113,8 @@ class SvMetaReference : public SvMetaName
>  protected:
>      SvMetaReferenceRef  aRef;
>  public:
> -            TYPEINFO_OVERRIDE();
> -            SvMetaReference();
> +    TYPEINFO_OVERRIDE();
> +    SvMetaReference();
>
>      const SvString &    GetName() const SAL_OVERRIDE
>                          {
> diff --git a/include/oox/helper/refmap.hxx b/include/oox/helper/refmap.hxx
> index e3efbfa..b23d4bd 100644
> --- a/include/oox/helper/refmap.hxx
> +++ b/include/oox/helper/refmap.hxx
> @@ -38,8 +38,8 @@ namespace oox {
>      key before.
>   */
>  template< typename KeyType, typename ObjType, typename CompType =
> std::less< KeyType > >
> -class RefMap : public std::map< KeyType, std::shared_ptr< ObjType >,
> CompType >
> -{
> +
> +class RefMap {
>  public:
>      typedef std::map< KeyType, std::shared_ptr< ObjType >, CompType >
> container_type;
>      typedef typename container_type::key_type
>   key_type;
> @@ -47,7 +47,6 @@ public:
>      typedef typename container_type::value_type
>   value_type;
>      typedef typename container_type::key_compare
>    key_compare;
>
> -public:
>      /** Returns true, if the object associated to the passed key exists.
>          Returns false, if the key exists but points to an empty
> reference. */
>      bool                has( key_type nKey ) const
> @@ -69,7 +68,7 @@ public:
>      template< typename FunctorType >
>      void                forEach( const FunctorType& rFunctor ) const
>                          {
> -                            std::for_each( this->begin(), this->end(),
> ForEachFunctor< FunctorType >( rFunctor ) );
> +                            std::for_each( this->my_Mapref.begin(),
> this->my_Mapref.end(), ForEachFunctor< FunctorType >( rFunctor ) );
>                          }
>
>      /** Calls the passed member function of ObjType on every contained
> object,
> @@ -118,7 +117,7 @@ public:
>      template< typename FunctorType >
>      void                forEachWithKey( const FunctorType& rFunctor )
> const
>                          {
> -                            std::for_each( this->begin(), this->end(),
> ForEachFunctorWithKey< FunctorType >( rFunctor ) );
> +                            std::for_each( this->my_Mapref.begin(),
> this->my_Mapref.end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) );
>                          }
>
>      /** Calls the passed member function of ObjType on every contained
> object.
> @@ -172,9 +171,12 @@ private:
>
>      const mapped_type* getRef( key_type nKey ) const
>      {
> -        typename container_type::const_iterator aIt = this->find( nKey );
> -        return (aIt == this->end()) ? 0 : &aIt->second;
> +        typename container_type::const_iterator aIt =
> this->my_Mapref.find( nKey );
> +        return (aIt == this->my_Mapref.end()) ? 0 : &aIt->second;
>      }
> +
> +    std::map< KeyType, std::shared_ptr< ObjType >, CompType > my_Mapref;
> +
>  };
>
>
> diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
> index 8768cc0..def276f 100644
> --- a/sw/inc/docary.hxx
> +++ b/sw/inc/docary.hxx
> @@ -58,8 +58,8 @@ public:
>  };
>
>  template<typename Value>
> -class SwVectorModifyBase : public std::vector<Value>
> -{
> +class SwVectorModifyBase{
> +
>  public:
>      typedef typename std::vector<Value>::const_iterator const_iterator;
>
> @@ -71,6 +71,7 @@ protected:
>
>  private:
>      const DestructorPolicy mPolicy;
> +    std::vector<Value>  my_Values;
>
>  protected:
>      // default destructor deletes all contained elements
> @@ -85,7 +86,7 @@ public:
>      virtual ~SwVectorModifyBase()
>      {
>          if (mPolicy == DestructorPolicy::FreeElements)
> -            for(const_iterator it = begin(); it != end(); ++it)
> +            for(const_iterator it = my_Values.begin(); it !=
> my_values.end(); ++it)
>                  delete *it;
>      }
>
> @@ -93,20 +94,20 @@ public:
>      {
>          if (aEndIdx < aStartIdx)
>              return;
> -        for (const_iterator it = begin() + aStartIdx;
> -                            it != begin() + aEndIdx; ++it)
> +        for (const_iterator it = my_Values.begin() + aStartIdx;
> +                            it != my_Values.begin() + aEndIdx; ++it)
>              delete *it;
> -        this->erase( begin() + aStartIdx, begin() + aEndIdx);
> +        this->my_Values.erase( my_Values.begin() + aStartIdx,
> my_Values.begin() + aEndIdx);
>      }
>
>      sal_uInt16 GetPos(Value const& p) const
>      {
> -        const_iterator const it = std::find(begin(), end(), p);
> -        return it == end() ? USHRT_MAX : it - begin();
> +        const_iterator const it = std::find(my_Values.begin(),
> my_Values.end(), p);
> +        return it == my_Values.end() ? USHRT_MAX : it - my_Values.begin();
>      }
>
>      bool Contains(Value const& p) const
> -        { return std::find(begin(), end(), p) != end(); }
> +        { return std::find(my_Values.begin(), my_Values.end(), p) !=
> my_Values.end(); }
>
>      void dumpAsXml(struct _xmlTextWriter* /*pWriter*/) const {};
>  };
> diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
> index eb303d6..4b0ec59 100644
> --- a/sw/inc/swtable.hxx
> +++ b/sw/inc/swtable.hxx
> @@ -63,7 +63,7 @@ class SwServerObject;
>
>  void sw_GetTblBoxColStr( sal_uInt16 nCol, OUString& rNm );
>
> -class SwTableLines : public std::vector<SwTableLine*> {
> +class SwTableLines {
>  public:
>      // free's any remaining child objects
>      ~SwTableLines();
> @@ -71,19 +71,24 @@ public:
>      // return USHRT_MAX if not found, else index of position
>      sal_uInt16 GetPos(const SwTableLine* pBox) const
>      {
> -        const_iterator it = std::find(begin(), end(), pBox);
> +        const_iterator it = std::find(my_SWTbLine.begin(),
> my_SWTbLine.end(), pBox);
>          return it == end() ? USHRT_MAX : it - begin();
>      }
> +
> +private:
> +    std::vector<SwTableLine*>      my_SWTbLine;
>  };
>
> -class SwTableBoxes : public std::vector<SwTableBox*> {
> +class SwTableBoxes{
>  public:
>      // return USHRT_MAX if not found, else index of position
>      sal_uInt16 GetPos(const SwTableBox* pBox) const
>      {
> -        const_iterator it = std::find(begin(), end(), pBox);
> -        return it == end() ? USHRT_MAX : it - begin();
> +        const_iterator it = std::find(my_SwTblBox.begin(),
> my_SwTblBox.end(), pBox);
> +        return it == my_SwTblBox.end() ? USHRT_MAX : it -
> my_SwTblBox.begin();
>      }
> +private:
> +    std::vector<SwTableBox*>  my_SwTblBox;
>  };
>
>  // Save content-bearing box-pointers additionally in a sorted array
> diff --git a/sw/source/filter/ww8/types.hxx
> b/sw/source/filter/ww8/types.hxx
> index a57b99b..7bac66b 100644
> --- a/sw/source/filter/ww8/types.hxx
> +++ b/sw/source/filter/ww8/types.hxx
> @@ -24,10 +24,12 @@
>
>  namespace ww
>  {
> -    class bytes : public std::vector<sal_uInt8>
> -    {
> +    class bytes{
> +
>          public:
> -            const sal_uInt8* data() const { return empty() ? 0 :
> &front(); }
> +            const sal_uInt8* data() const { return my_uInt8.empty() ? 0 :
> &my_uInt8.front(); }
> +        private:
> +            std::vector<sal_uInt8> my_uInt8;
>      };
>
>      enum WordVersion {eWW1 = 1, eWW2 = 2, eWW6 = 6, eWW7 = 7, eWW8 = 8};
>
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150409/2ce2b206/attachment.html>


More information about the LibreOffice mailing list