DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
/*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library http://www.boost.org/ State machine detecting include guards in an included file. This detects two forms of include guards: #ifndef INCLUDE_GUARD_MACRO #define INCLUDE_GUARD_MACRO ... #endif or if !defined(INCLUDE_GUARD_MACRO) #define INCLUDE_GUARD_MACRO ... #endif note, that the parenthesis are optional (i.e. !defined INCLUDE_GUARD_MACRO will work as well). The code allows for any whitespace, newline and single '#' tokens before the #if/#ifndef and after the final #endif. Copyright (c) 2001-2008 Hartmut Kaiser. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #if !defined(DETECT_INCLUDE_GUARDS_HK060304_INCLUDED) #define DETECT_INCLUDE_GUARDS_HK060304_INCLUDED #include
#include
// this must occur after all of the includes and before any code appears #ifdef BOOST_HAS_ABI_HEADERS #include BOOST_ABI_PREFIX #endif /////////////////////////////////////////////////////////////////////////////// namespace boost { namespace wave { namespace cpplexer { template
class include_guards { public: include_guards() : state(&include_guards::state_0), detected_guards(false), current_state(true), if_depth(0) {} Token const& detect_guard(Token const& t) { return current_state ? (this->*state)(t) : t; } bool detected(std::string& guard_name_) const { if (detected_guards) { guard_name_ = guard_name.c_str(); return true; } return false; } private: typedef Token const& state_type(Token const& t); state_type include_guards::* state; bool detected_guards; bool current_state; typename Token::string_type guard_name; int if_depth; state_type state_0, state_1, state_2, state_3, state_4, state_5; state_type state_1a, state_1b, state_1c, state_1d, state_1e; bool is_skippable(token_id id) const { return (T_POUND == BASE_TOKEN(id) || IS_CATEGORY(id, WhiteSpaceTokenType) || IS_CATEGORY(id, EOLTokenType)); } }; /////////////////////////////////////////////////////////////////////////////// // state 0: beginning of a file, tries to recognize #ifndef or #if tokens template
inline Token const& include_guards
::state_0(Token const& t) { token_id id = token_id(t); if (T_PP_IFNDEF == id) state = &include_guards::state_1; else if (T_PP_IF == id) state = &include_guards::state_1a; else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 1: found #ifndef, looking for T_IDENTIFIER template
inline Token const& include_guards
::state_1(Token const& t) { token_id id = token_id(t); if (T_IDENTIFIER == id) { guard_name = t.get_value(); state = &include_guards::state_2; } else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 1a: found T_PP_IF, looking for T_NOT ("!") template
inline Token const& include_guards
::state_1a(Token const& t) { token_id id = token_id(t); if (T_NOT == BASE_TOKEN(id)) state = &include_guards::state_1b; else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 1b: found T_NOT, looking for 'defined' template
inline Token const& include_guards
::state_1b(Token const& t) { token_id id = token_id(t); if (T_IDENTIFIER == id && t.get_value() == "defined") state = &include_guards::state_1c; else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 1c: found 'defined', looking for (optional) T_LEFTPAREN template
inline Token const& include_guards
::state_1c(Token const& t) { token_id id = token_id(t); if (T_LEFTPAREN == id) state = &include_guards::state_1d; else if (T_IDENTIFIER == id) { guard_name = t.get_value(); state = &include_guards::state_2; } else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 1d: found T_LEFTPAREN, looking for T_IDENTIFIER guard template
inline Token const& include_guards
::state_1d(Token const& t) { token_id id = token_id(t); if (T_IDENTIFIER == id) { guard_name = t.get_value(); state = &include_guards::state_1e; } else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 1e: found T_IDENTIFIER guard, looking for T_RIGHTPAREN template
inline Token const& include_guards
::state_1e(Token const& t) { token_id id = token_id(t); if (T_RIGHTPAREN == id) state = &include_guards::state_2; else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 2: found T_IDENTIFIER, looking for #define template
inline Token const& include_guards
::state_2(Token const& t) { token_id id = token_id(t); if (T_PP_DEFINE == id) state = &include_guards::state_3; else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 3: found #define, looking for T_IDENTIFIER as recognized by state 1 template
inline Token const& include_guards
::state_3(Token const& t) { token_id id = token_id(t); if (T_IDENTIFIER == id && t.get_value() == guard_name) state = &include_guards::state_4; else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// // state 4: found guard T_IDENTIFIER, looking for #endif template
inline Token const& include_guards
::state_4(Token const& t) { token_id id = token_id(t); if (T_PP_IF == id || T_PP_IFDEF == id || T_PP_IFNDEF == id) ++if_depth; else if (T_PP_ENDIF == id) { if (if_depth > 0) --if_depth; else state = &include_guards::state_5; } return t; } /////////////////////////////////////////////////////////////////////////////// // state 5: found final #endif, looking for T_EOF template
inline Token const& include_guards
::state_5(Token const& t) { token_id id = token_id(t); if (T_EOF == id) detected_guards = current_state; else if (!is_skippable(id)) current_state = false; return t; } /////////////////////////////////////////////////////////////////////////////// } // namespace cpplexer } // namespace wave } // namespace boost // the suffix header occurs after all of the code #ifdef BOOST_HAS_ABI_HEADERS #include BOOST_ABI_SUFFIX #endif #endif // !DETECT_INCLUDE_GUARDS_HK060304_INCLUDED
detect_include_guards.hpp
Page URL
File URL
Prev
7/9
Next
Download
( 7 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.