Adobe.com
Contents Suites Classes Class Index Member Index

AIDictionaryKeyHelper.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 "AIDictionary.h"
00020 #include <array>
00021 #include "AIAssert.hpp"
00022 
00079 #define DictionaryKeyDeclare(keyName, keyStr) \
00080 class DictionaryKey##keyName \
00081 { \
00082 public: \
00083         inline const AIDictKey & GetAIDictKey() \
00084         { \
00085                 if (fKey == nullptr) \
00086                 { \
00087                         fKey = sAIDictionary->Key(keyStr); \
00088                 } \
00089                 return fKey; \
00090         } \
00091         inline operator const AIDictKey & () { return GetAIDictKey(); } \
00092         DictionaryKey##keyName() {} \
00093         DictionaryKey##keyName(const DictionaryKey##keyName &) = delete; \
00094         DictionaryKey##keyName(DictionaryKey##keyName &&) = delete; \
00095         DictionaryKey##keyName & operator = (const DictionaryKey##keyName &) = delete; \
00096         DictionaryKey##keyName & operator = (DictionaryKey##keyName &&) = delete; \
00097 private: \
00098         AIDictKey fKey{}; \
00099 }; \
00100 extern class DictionaryKey##keyName keyName
00101 
00102 
00103 #define DictionaryKeyDefine(keyName) \
00104 class DictionaryKey##keyName keyName
00105 
00106 
00107 #define DictionaryKeyDeclareAndDefine(keyName, keyStr) \
00108 DictionaryKeyDeclare(keyName, keyStr); \
00109 DictionaryKeyDefine(keyName)
00110 
00111 
00112 #define InternalFromExternalKeyDeclare(externalKeyName) \
00113 DictionaryKeyDeclare(DictKey_##externalKeyName, externalKeyName)
00114 
00115 
00116 #define InternalFromExternalKeyDefine(externalKeyName) \
00117 DictionaryKeyDefine(DictKey_##externalKeyName)
00118 
00119 
00120 #define InternalFromExternalKeyDeclareAndDefine(externalKeyName) \
00121 DictionaryKeyDeclareAndDefine(DictKey_##externalKeyName, externalKeyName)
00122 
00123 
00124 #define DictionaryKeyArrayDeclareAndDefine(keyName, keyStrArrayName) \
00125 template < size_t N > class DictionaryKeyArray##keyName \
00126 { \
00127 public: \
00128         inline const AIDictKey & operator [] (size_t index) \
00129         { \
00130                 AIMsgAssert(index < fKeys.size(), "Index out of bounds when trying to access dictionary key!"); \
00131                 auto& key(fKeys.at(index)); \
00132                 if (key == nullptr) \
00133                 { \
00134                         key = sAIDictionary->Key(keyStrArrayName[index]); \
00135                 } \
00136                 return key; \
00137         } \
00138         DictionaryKeyArray##keyName() {} \
00139         DictionaryKeyArray##keyName(const DictionaryKeyArray##keyName &) = delete; \
00140         DictionaryKeyArray##keyName(DictionaryKeyArray##keyName &&) = delete; \
00141         DictionaryKeyArray##keyName & operator = (const DictionaryKeyArray##keyName &) = delete; \
00142         DictionaryKeyArray##keyName & operator = (DictionaryKeyArray##keyName &&) = delete; \
00143 private: \
00144         std::array < AIDictKey, N > fKeys{}; \
00145 }; \
00146 class DictionaryKeyArray##keyName < sizeof(keyStrArrayName) / sizeof(keyStrArrayName[0]) > keyName
00147 
00148 
00149 #define InternalFromExternalKeyArrayDeclareAndDefine(externalKeyStrArrayName) \
00150 DictionaryKeyArrayDeclareAndDefine(DictKey_##externalKeyStrArrayName, externalKeyStrArrayName)


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