/usr/include/podofo/base/PdfArray.h is in libpodofo-dev 0.9.0-1.2+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | /***************************************************************************
* Copyright (C) 2006 by Dominik Seichter *
* domseichter@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PDF_ARRAY_H_
#define _PDF_ARRAY_H_
#ifdef _WIN32
#ifdef _MSC_VER
// IC: VS2008 suppress dll warning
#pragma warning(disable: 4275)
#endif // _MSC_VER
#endif // _WIN32
#include "PdfDefines.h"
#include "PdfDataType.h"
#include "PdfObject.h"
namespace PoDoFo {
/** This class represents a PdfArray
* Use it for all arrays that are written to a PDF file.
*
* A PdfArray can hold any PdfVariant.
*
* \see PdfVariant
*/
typedef std::vector<PdfObject> PdfArrayBaseClass;
class PODOFO_API PdfArray : private PdfArrayBaseClass, public PdfDataType {
public:
typedef PdfArrayBaseClass::iterator iterator;
typedef PdfArrayBaseClass::const_iterator const_iterator;
typedef PdfArrayBaseClass::reverse_iterator reverse_iterator;
typedef PdfArrayBaseClass::const_reverse_iterator const_reverse_iterator;
/** Create an empty array
*/
PdfArray();
/** Create an array and add one value to it.
* The value is copied.
*
* \param var add this object to the array.
*/
explicit PdfArray( const PdfObject & var );
/** Deep copy an existing PdfArray
*
* \param rhs the array to copy
*/
PdfArray( const PdfArray & rhs );
virtual ~PdfArray();
/** assignment operator
*
* \param rhs the array to assign
*/
PdfArray& operator=(const PdfArray& rhs);
/**
* \returns the size of the array
*/
inline size_t GetSize() const;
/** Remove all elements from the array
*/
inline void Clear();
/** Write the array to an output device.
* This is an overloaded member function.
*
* \param pDevice write the object to this device
* \param eWriteMode additional options for writing this object
* \param pEncrypt an encryption object which is used to encrypt this object
* or NULL to not encrypt this object
*/
virtual void Write( PdfOutputDevice* pDevice, EPdfWriteMode eWriteMode,
const PdfEncrypt* pEncrypt = NULL ) const;
/** Utility method to determine if the array contains
* contains any objects of ePdfDataType_String whose
* value is the passed string.
* \param cmpString the string to compare against
* \returns true if success, false if not
*/
bool ContainsString( const std::string& cmpString ) const;
/** Utility method to return the actual index in the
* array which contains an object of ePdfDataType_String whose
* value is the passed string.
* \param cmpString the string to compare against
* \returns true if success, false if not
*/
size_t GetStringIndex( const std::string& cmpString ) const;
/** Adds a PdfObject to the array
*
* \param var add a PdfObject to the array
*
* This will set the dirty flag of this object.
* \see IsDirty
*/
inline void push_back( const PdfObject & var );
/**
* \returns the size of the array
*/
inline size_t size() const;
/**
* \returns true if the array is empty.
*/
inline bool empty() const;
inline PdfObject & operator[](size_type __n);
inline const PdfObject & operator[](size_type __n) const;
/**
* Returns a read/write iterator that points to the first
* element in the array. Iteration is done in ordinary
* element order.
*/
inline iterator begin();
/**
* Returns a read-only (constant) iterator that points to the
* first element in the array. Iteration is done in ordinary
* element order.
*/
inline const_iterator begin() const;
/**
* Returns a read/write iterator that points one past the last
* element in the array. Iteration is done in ordinary
* element order.
*/
inline iterator end();
/**
* Returns a read-only (constant) iterator that points one past
* the last element in the array. Iteration is done in
* ordinary element order.
*/
inline const_iterator end() const;
/**
* Returns a read/write reverse iterator that points to the
* last element in the array. Iteration is done in reverse
* element order.
*/
inline reverse_iterator rbegin();
/**
* Returns a read-only (constant) reverse iterator that points
* to the last element in the array. Iteration is done in
* reverse element order.
*/
inline const_reverse_iterator rbegin() const;
/**
* Returns a read/write reverse iterator that points to one
* before the first element in the array. Iteration is done
* in reverse element order.
*/
inline reverse_iterator rend();
/**
* Returns a read-only (constant) reverse iterator that points
* to one before the first element in the array. Iteration
* is done in reverse element order.
*/
inline const_reverse_iterator rend() const;
#if defined(_MSC_VER) && _MSC_VER <= 1200 // workaround template-error in Visualstudio 6
inline void insert(iterator __position,
iterator __first,
iterator __last);
#else
template<typename _InputIterator>
void insert(const iterator& __position,
const _InputIterator& __first,
const _InputIterator& __last);
#endif
inline PdfArray::iterator insert(const iterator& __position, const PdfObject & val );
inline void erase( const iterator& pos );
inline void erase( const iterator& first, const iterator& last );
inline void reserve(size_type __n);
/**
* \returns a read/write reference to the data at the first
* element of the array.
*/
inline reference front();
/**
* \returns a read-only (constant) reference to the data at the first
* element of the array.
*/
inline const_reference front() const;
/**
* \returns a read/write reference to the data at the last
* element of the array.
*/
inline reference back();
/**
* \returns a read-only (constant) reference to the data at the
* last element of the array.
*/
inline const_reference back() const;
inline bool operator==( const PdfArray & rhs ) const;
inline bool operator!=( const PdfArray & rhs ) const;
/** The dirty flag is set if this variant
* has been modified after construction.
*
* Usually the dirty flag is also set
* if you call any non-const member function
* as we cannot determine if you actually changed
* something or not.
*
* \returns true if the value is dirty and has been
* modified since construction
*/
virtual bool IsDirty() const;
/** Sets the dirty flag of this PdfVariant
*
* \param bDirty true if this PdfVariant has been
* modified from the outside
*
* \see IsDirty
*/
virtual void SetDirty( bool bDirty );
private:
bool m_bDirty; ///< Indicates if this object was modified after construction
};
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::Clear()
{
AssertMutable();
this->clear();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
size_t PdfArray::GetSize() const
{
return this->size();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::push_back( const PdfObject & var )
{
AssertMutable();
PdfArrayBaseClass::push_back( var );
m_bDirty = true;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
size_t PdfArray::size() const
{
return PdfArrayBaseClass::size();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfArray::empty() const
{
return PdfArrayBaseClass::empty();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfObject& PdfArray::operator[](size_type __n)
{
AssertMutable();
m_bDirty = true;
return PdfArrayBaseClass::operator[](__n);
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfObject& PdfArray::operator[](size_type __n) const
{
return PdfArrayBaseClass::operator[](__n);
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::iterator PdfArray::begin()
{
return PdfArrayBaseClass::begin();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::const_iterator PdfArray::begin() const
{
return PdfArrayBaseClass::begin();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::iterator PdfArray::end()
{
return PdfArrayBaseClass::end();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::const_iterator PdfArray::end() const
{
return PdfArrayBaseClass::end();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::reverse_iterator PdfArray::rbegin()
{
return PdfArrayBaseClass::rbegin();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::const_reverse_iterator PdfArray::rbegin() const
{
return PdfArrayBaseClass::rbegin();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::reverse_iterator PdfArray::rend()
{
return PdfArrayBaseClass::rend();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::const_reverse_iterator PdfArray::rend() const
{
return PdfArrayBaseClass::rend();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
#if defined(_MSC_VER) && _MSC_VER <= 1200 // workaround template-error in Visualstudio 6
void PdfArray::insert(PdfArray::iterator __position,
PdfArray::iterator __first,
PdfArray::iterator __last)
#else
template<typename _InputIterator>
void PdfArray::insert(const PdfArray::iterator& __position,
const _InputIterator& __first,
const _InputIterator& __last)
#endif
{
AssertMutable();
PdfArrayBaseClass::insert( __position, __first, __last );
m_bDirty = true;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::iterator PdfArray::insert(const iterator& __position, const PdfObject & val )
{
AssertMutable();
m_bDirty = true;
return PdfArrayBaseClass::insert( __position, val );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::erase( const iterator& pos )
{
AssertMutable();
PdfArrayBaseClass::erase( pos );
m_bDirty = true;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::erase( const iterator& first, const iterator& last )
{
AssertMutable();
PdfArrayBaseClass::erase( first, last );
m_bDirty = true;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::reserve(size_type __n)
{
PdfArrayBaseClass::reserve( __n );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfObject & PdfArray::front()
{
return PdfArrayBaseClass::front();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfObject & PdfArray::front() const
{
return PdfArrayBaseClass::front();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfObject & PdfArray::back()
{
return PdfArrayBaseClass::back();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfObject & PdfArray::back() const
{
return PdfArrayBaseClass::back();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfArray::operator==( const PdfArray & rhs ) const
{
//TODO: This operator does not check for m_bDirty. Add comparison or add explanation why it should not be there
return (static_cast< PdfArrayBaseClass >(*this) == static_cast< PdfArrayBaseClass >(rhs) );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfArray::operator!=( const PdfArray & rhs ) const
{
//TODO: This operator does not check for m_bDirty. Add comparison or add explanation why it should not be there
return (static_cast< PdfArrayBaseClass >(*this) != static_cast< PdfArrayBaseClass >(rhs) );
}
typedef PdfArray TVariantList;
typedef PdfArray::iterator TIVariantList;
typedef PdfArray::const_iterator TCIVariantList;
};
#endif // _PDF_ARRAY_H_
|