Hot Door CORE 0.8.3
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Macros
hdicoreMacros.h File Reference

Header file for a variety of plugin convenience macros. More...

This graph shows which files directly or indirectly include this file:

Macros

#define HDI_CORE_APP_VERSION_NUMBER   29
 
#define HDI_CORE_COMPILE_AI29_PLUS   1
 
#define HDI_CORE_COMPILE_AI28_PLUS   1
 
#define HDI_CORE_COMPILE_AI27_PLUS   1
 
#define HDI_CORE_COMPILE_AI26_PLUS   1
 
#define HDI_CORE_COMPILE_AI25_PLUS   1
 
#define HDI_CORE_COMPILE_AI25_MINUS   0
 
#define HDI_CORE_COMPILE_AI26_MINUS   0
 
#define HDI_CORE_COMPILE_AI27_MINUS   0
 
#define HDI_CORE_COMPILE_AI28_MINUS   0
 
#define HDI_CORE_COMPILE_AI29_MINUS   1
 
#define HDI_CORE_COMPILE_PS22_PLUS   0
 
#define HDI_CORE_COMPILE_PS22_MINUS   0
 
#define __HDI_CORE_BREAK_BLOCK_VAR(__HDI_N__)   __hdi_core_breakblock_ ## __HDI_N__
 Helpers for the HDI_BREAK_BLOCK macro.
 
#define HDI_CORE_BREAK_BLOCK_VAR(__HDI_N__)   __HDI_CORE_BREAK_BLOCK_VAR(__HDI_N__)
 
#define HDI_CORE_BREAK_BLOCK
 Helps to create a guaranteed one-iteration while loop for easy cleanup control (a common C++ practice, in one fashion or another)
 

Detailed Description

Header file for a variety of plugin convenience macros.

Macro Definition Documentation

◆ HDI_CORE_BREAK_BLOCK

#define HDI_CORE_BREAK_BLOCK
Value:
short HDI_CORE_BREAK_BLOCK_VAR(__LINE__) = 0; \
while( (++HDI_CORE_BREAK_BLOCK_VAR(__LINE__)) == 1 )

Helps to create a guaranteed one-iteration while loop for easy cleanup control (a common C++ practice, in one fashion or another)

Let's say you have a function with lots of initial conditions to check before proceeding with the desired task, but every time a condition fails lots of lines of cleanup code need to be executed. One way to approach this is with many nested if-blocks (ugly and hard to read), or with pasting the cleanup code in each sequential condition's block (hard to maintain and error prone). A much better alternative to either approach is to use a loop or switch to create a block within which the "break" keyword can be used, and put the cleanup code outside of the block (such that breaking out of the block or successfully executing the entirety of the block will always result in the same cleanup code being executed afterwards, and without any of the drawbacks of the aforementioned approaches).