ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h in xlsxwriter-0.0.3 vs ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h in xlsxwriter-0.0.4.pre.2
- old
+ new
@@ -14,12 +14,12 @@
*/
#ifndef __LXW_COMMON_H__
#define __LXW_COMMON_H__
#include <time.h>
-#include "xlsxwriter/third_party/queue.h"
-#include "xlsxwriter/third_party/tree.h"
+#include "third_party/queue.h"
+#include "third_party/tree.h"
#ifndef TESTING
#define STATIC static
#else
#define STATIC
@@ -87,10 +87,13 @@
LXW_ERROR_INVALID_SHEETNAME_CHARACTER,
/** Worksheet name is already in use. */
LXW_ERROR_SHEETNAME_ALREADY_USED,
+ /** Parameter exceeds Excel's limit of 32 characters. */
+ LXW_ERROR_32_STRING_LENGTH_EXCEEDED,
+
/** Parameter exceeds Excel's limit of 128 characters. */
LXW_ERROR_128_STRING_LENGTH_EXCEEDED,
/** Parameter exceeds Excel's limit of 255 characters. */
LXW_ERROR_255_STRING_LENGTH_EXCEEDED,
@@ -220,9 +223,45 @@
#define LXW_WARN_FORMAT1(message, var) \
fprintf(stderr, "[WARNING]: " message "\n", var)
#define LXW_WARN_FORMAT2(message, var1, var2) \
fprintf(stderr, "[WARNING]: " message "\n", var1, var2)
+
+/* Chart axis type checks. */
+#define LXW_WARN_CAT_AXIS_ONLY(function) \
+ if (!axis->is_category) { \
+ fprintf(stderr, "[WARNING]: " \
+ function "() is only valid for category axes\n"); \
+ return; \
+ }
+
+#define LXW_WARN_VALUE_AXIS_ONLY(function) \
+ if (!axis->is_value) { \
+ fprintf(stderr, "[WARNING]: " \
+ function "() is only valid for value axes\n"); \
+ return; \
+ }
+
+#define LXW_WARN_DATE_AXIS_ONLY(function) \
+ if (!axis->is_date) { \
+ fprintf(stderr, "[WARNING]: " \
+ function "() is only valid for date axes\n"); \
+ return; \
+ }
+
+#define LXW_WARN_CAT_AND_DATE_AXIS_ONLY(function) \
+ if (!axis->is_category && !axis->is_date) { \
+ fprintf(stderr, "[WARNING]: " \
+ function "() is only valid for category and date axes\n"); \
+ return; \
+ }
+
+#define LXW_WARN_VALUE_AND_DATE_AXIS_ONLY(function) \
+ if (!axis->is_value && !axis->is_date) { \
+ fprintf(stderr, "[WARNING]: " \
+ function "() is only valid for value and date axes\n"); \
+ return; \
+ }
#ifndef LXW_BIG_ENDIAN
#define LXW_UINT32_NETWORK(n) ((((n) & 0xFF) << 24) | \
(((n) & 0xFF00) << 8) | \
(((n) & 0xFF0000) >> 8) | \