Adobe.com
Contents Suites Classes Class Index Member Index

IAIArtSet.hpp

Go to the documentation of this file.
00001 /*************************************************************************
00002 *
00003 * ADOBE CONFIDENTIAL
00004 * 
00005 * Copyright 2017 Adobe
00006 * 
00007 * All Rights Reserved.
00008 *
00009 * NOTICE: Adobe permits you to use, modify, and distribute this file in
00010 * accordance with the terms of the Adobe license agreement accompanying
00011 * it. If you have received this file from a source other than Adobe,
00012 * then your use, modification, or distribution of it requires the prior
00013 * written permission of Adobe.
00014 *
00015 **************************************************************************/
00016 
00017 #pragma once
00018 
00019 #include "AIArtSet.h"
00020 #include "IAIArtboards.hpp"
00021 #include "IAIUnicodeString.h"
00022 
00023 #include <memory>
00024 
00027 namespace ai
00028 {
00138         class ArtSet
00139         {
00140         public:
00141                 class iterator;
00142 
00143                 using value_type = AIArtHandle;
00144 
00147                 explicit ArtSet(bool fillWithSelectedArtObjects = false); 
00148 
00151                 explicit ArtSet(AIArtHandle *artArray, size_t count); 
00152                 
00155                 explicit ArtSet(AILayerHandle layer); 
00156 
00159                 template<std::size_t N>
00160                 ArtSet(const AIArtSpec(&specs)[N]) : ArtSet(&specs[0], N)
00161                 {
00162 
00163                 }
00164 
00167                 ArtSet(const AIArtSpec& spec) :ArtSet(&spec, 1) {}
00168 
00169                 //Needed for unique_ptr
00170                 ~ArtSet();
00171 
00175                 AIErr GenerateForAllLayers();
00176                 
00180                 AIErr GenerateForNthLayer(ai::int32 inLayerIndex);
00181                 
00185                 AIErr GenerateForNamedLayer(const ai::UnicodeString& inLayerName);
00186                 
00190                 AIErr GenerateForNthArtboard(ai::ArtboardID inArtboardIndex, bool skipHiddenArts);
00191                 
00195                 AIErr GenerateForNamedArtboard(const ai::UnicodeString& inArtboardName, bool skipHiddenArts);
00196                 
00200                 AIErr GenerateForTopLevelLayers(bool skipHiddenLayers);
00201 
00205                 AIErr GenerateSelectedAtTopLevel();
00206                 
00210                 AIErr GenerateNSelectedAtTopLevel(size_t inMaxSelectedArtsToReturn, bool *outHasMoreSelectedArts);
00211         
00216         AIErr GenerateForArt (AIArtHandle inArt);
00217                 
00220                 size_t size() const AINOEXCEPT;
00221                 
00224                 bool empty() const AINOEXCEPT { return size() == 0; }
00225                 
00228                 value_type at(size_t index) const;
00229                 
00232                 value_type operator[](size_t index) const AINOEXCEPT;
00233 
00236                 void insert(value_type art);
00237                 
00240                 void erase(value_type art);
00241                 
00244                 void replace(value_type oldArt, value_type newArt);
00245                 
00248                 void clear();
00249 
00252                 iterator begin() const AINOEXCEPT;
00253                 
00256                 iterator end() const AINOEXCEPT;
00257                 
00260                 iterator rbegin() const AINOEXCEPT;
00261                 
00264                 iterator rend() const AINOEXCEPT;
00265 
00268                 void swap(ArtSet& other) AINOEXCEPT;
00269 
00272                 explicit operator bool() const AINOEXCEPT;
00273                 
00276                 AIErr GetLastError() const AINOEXCEPT;
00277 
00280                 AIArtSet get() const AINOEXCEPT;
00281 
00284                 ArtSet(ArtSet&& other) AINOEXCEPT;
00285                 
00288                 ArtSet& operator = (ArtSet&& other) AINOEXCEPT;
00289 
00290         private:
00291                 ArtSet(const AIArtSpec* specs, size_t count);
00292                 ArtSet(const ArtSet&) = delete;
00293                 ArtSet& operator = (const ArtSet&) = delete;
00294 
00295                 class Impl;
00296                 std::unique_ptr<Impl> pImpl;
00297         };
00298 
00299         class ArtSet::iterator
00300         {
00301         public:
00302                 using value_type = AIArtHandle;
00303                 
00304                 iterator(const ArtSet& artSet, ptrdiff_t index, bool reverse = false) :
00305                         mArtSet(artSet), mIndex(index),mReverse(reverse)
00306                 {
00307                         mCount = mArtSet.size();
00308                 }
00309                 value_type operator*() const
00310                 {
00311                         if (mIndex >= 0 && mIndex < mCount)
00312                         {
00313                                 if(mValue == nullptr)
00314                                         mValue = mArtSet[mIndex];
00315                                 return mValue;
00316                         }
00317                         return nullptr;
00318                 }
00319 
00320                 void operator++()
00321                 {
00322                         if (mReverse)
00323                                 --mIndex;
00324                         else
00325                                 ++mIndex;
00326                         mValue = nullptr;
00327                 }
00328 
00329                 void operator--()
00330                 {
00331                         if (mReverse)
00332                                 ++mIndex;
00333                         else
00334                                 --mIndex;
00335                         mValue = nullptr;
00336                 }
00337 
00338                 bool operator!= (const iterator& other) const
00339                 {
00340                         return (mIndex != other.mIndex || mArtSet.pImpl.get() != other.mArtSet.pImpl.get());
00341                 }
00342 
00343                 iterator(const iterator&) = default;
00344                 iterator(iterator&&) = default;
00345 #if !defined(ILLUSTRATOR_MINIMAL)
00346                 iterator& operator = (const iterator&) = delete;
00347                 iterator& operator = (iterator&&) = delete;
00348 #endif
00349         private:
00350                 ptrdiff_t mIndex = 0;
00351                 ptrdiff_t mCount = 0;
00352                 mutable value_type mValue = nullptr;
00353                 const ArtSet& mArtSet;
00354                 bool mReverse = false;
00355         };
00356 }


Contents Suites Classes Class Index Member Index
Adobe Solutions Network
 
Copyright © 2014 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks