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 A generic C++ lexer token definition http://www.boost.org/ 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(CPP_TOKEN_HPP_53A13BD2_FBAA_444B_9B8B_FCB225C2BBA8_INCLUDED) #define CPP_TOKEN_HPP_53A13BD2_FBAA_444B_9B8B_FCB225C2BBA8_INCLUDED #include
#if BOOST_WAVE_SERIALIZATION != 0 #include
#endif #include
#include
#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 { namespace impl { template
class token_data { public: typedef StringTypeT string_type; typedef PositionT position_type; token_data() : id(T_EOI), refcnt(1) {} token_data(token_id id_, string_type const &value_, position_type const &pos_) : id(id_), value(value_), pos(pos_), refcnt(1) {} token_data(token_data const& rhs) : id(rhs.id), value(rhs.value), pos(rhs.pos), refcnt(1) {} ~token_data() {} std::size_t addref() { return ++refcnt; } std::size_t release() { return --refcnt; } std::size_t get_refcnt() const { return refcnt; } // accessors operator token_id() const { return id; } string_type const &get_value() const { return value; } position_type const &get_position() const { return pos; } void set_token_id (token_id id_) { id = id_; } void set_value (string_type const &value_) { value = value_; } void set_position (position_type const &pos_) { pos = pos_; } friend bool operator== (token_data const& lhs, token_data const& rhs) { // two tokens are considered equal even if they refer to different // positions return (lhs.id == rhs.id && lhs.value == rhs.value) ? true : false; } static void *operator new(std::size_t size); static void operator delete(void *p, std::size_t size); #if defined(BOOST_SPIRIT_DEBUG) // debug support void print (std::ostream &stream) const { stream << get_token_name(id) << "("; for (std::size_t i = 0; i < value.size(); ++i) { switch (value[i]) { case '\r': stream << "\\r"; break; case '\n': stream << "\\n"; break; default: stream << value[i]; break; } } stream << ")"; } #endif // defined(BOOST_SPIRIT_DEBUG) #if BOOST_WAVE_SERIALIZATION != 0 friend class boost::serialization::access; template
void serialize(Archive &ar, const unsigned int version) { using namespace boost::serialization; ar & make_nvp("id", id); ar & make_nvp("value", value); ar & make_nvp("position", pos); } #endif private: token_id id; // the token id string_type value; // the text, which was parsed into this token position_type pos; // the original file position std::size_t refcnt; }; /////////////////////////////////////////////////////////////////////////////// struct token_data_tag {}; template
inline void * token_data
::operator new(std::size_t size) { BOOST_ASSERT(sizeof(token_data
) == size); typedef boost::singleton_pool< token_data_tag, sizeof(token_data
) > pool_type; void *ret = pool_type::malloc(); if (0 == ret) throw std::bad_alloc(); return ret; } template
inline void token_data
::operator delete(void *p, std::size_t size) { BOOST_ASSERT(sizeof(token_data
) == size); typedef boost::singleton_pool< token_data_tag, sizeof(token_data
) > pool_type; if (0 != p) pool_type::free(p); } } // namespace impl /////////////////////////////////////////////////////////////////////////////// // forward declaration of the token type template
class lex_token; /////////////////////////////////////////////////////////////////////////////// // // lex_token // /////////////////////////////////////////////////////////////////////////////// template
class lex_token { public: typedef BOOST_WAVE_STRINGTYPE string_type; typedef PositionT position_type; lex_token() : data(new impl::token_data
()) {} lex_token(lex_token const& rhs) : data(rhs.data) { data->addref(); } lex_token(token_id id_, string_type const &value_, PositionT const &pos_) : data(new impl::token_data
(id_, value_, pos_)) {} ~lex_token() { if (0 == data->release()) delete data; data = 0; } lex_token& operator=(lex_token const& rhs) { if (&rhs != this) { if (0 == data->release()) delete data; data = rhs.data; data->addref(); } return *this; } // accessors operator token_id() const { return token_id(*data); } string_type const &get_value() const { return data->get_value(); } position_type const &get_position() const { return data->get_position(); } bool is_eoi() const { return token_id(*data) == T_EOI; } void set_token_id (token_id id_) { make_unique(); data->set_token_id(id_); } void set_value (string_type const &value_) { make_unique(); data->set_value(value_); } void set_position (position_type const &pos_) { make_unique(); data->set_position(pos_); } friend bool operator== (lex_token const& lhs, lex_token const& rhs) { return *(lhs.data) == *(rhs.data); } // debug support #if BOOST_WAVE_DUMP_PARSE_TREE != 0 // access functions for the tree_to_xml functionality static int get_token_id(lex_token const &t) { return token_id(t); } static string_type get_token_value(lex_token const &t) { return t.get_value(); } #endif #if defined(BOOST_SPIRIT_DEBUG) // debug support void print (std::ostream &stream) const { data->print(stream); } #endif // defined(BOOST_SPIRIT_DEBUG) private: #if BOOST_WAVE_SERIALIZATION != 0 friend class boost::serialization::access; template
void serialize(Archive &ar, const unsigned int version) { data->serialize(ar, version); } #endif // make a unique copy of the current object void make_unique() { if (1 == data->get_refcnt()) return; impl::token_data
*newdata = new impl::token_data
(*data); data->release(); // release this reference, can't get zero data = newdata; } impl::token_data
*data; }; /////////////////////////////////////////////////////////////////////////////// #if defined(BOOST_SPIRIT_DEBUG) template
inline std::ostream & operator<< (std::ostream &stream, lex_token
const &object) { object.print(stream); return stream; } #endif // defined(BOOST_SPIRIT_DEBUG) /////////////////////////////////////////////////////////////////////////////// } // 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 // !defined(CPP_TOKEN_HPP_53A13BD2_FBAA_444B_9B8B_FCB225C2BBA8_INCLUDED)
cpp_lex_token.hpp
Page URL
File URL
Prev
5/9
Next
Download
( 8 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.