blob: e51c4d4486de1db21b785976d9d7e72da7bc2dbd [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_VECTOR_ICONS_CC_MACROS_H_
#define COMPONENTS_VECTOR_ICONS_CC_MACROS_H_
// This file holds macros that are common to each vector icon target's
// vector_icons.cc.template file.
// The prefix is used to help make sure the string IDs are unique. Typically,
// matching the namespace of the icons should ensure that is the case. If the
// vector_icons.cc.template file doesn't define a prefix, we'll go without one.
#ifndef VECTOR_ICON_ID_PREFIX
#define VECTOR_ICON_ID_PREFIX ""
#endif
#define VECTOR_ICON_REP_TEMPLATE(path_name, ...) \
static constexpr gfx::PathElement path_name[] = {__VA_ARGS__};
#define VECTOR_ICON_TEMPLATE_CC(rep_list_name, icon_name, ...) \
constexpr char icon_name##Id[] = VECTOR_ICON_ID_PREFIX #icon_name; \
static constexpr gfx::VectorIconRep rep_list_name[] = {__VA_ARGS__}; \
const gfx::VectorIcon icon_name = {rep_list_name, arraysize(rep_list_name), \
icon_name##Id};
#else // !COMPONENTS_VECTOR_ICONS_CC_MACROS_H_
#error This file should only be included once.
#endif // COMPONENTS_VECTOR_ICONS_CC_MACROS_H_