当前位置: 首页>>代码示例>>C++>>正文


C++ ios_base::pword方法代码示例

本文整理汇总了C++中std::ios_base::pword方法的典型用法代码示例。如果您正苦于以下问题:C++ ios_base::pword方法的具体用法?C++ ios_base::pword怎么用?C++ ios_base::pword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::ios_base的用法示例。


在下文中一共展示了ios_base::pword方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: callback

void callback(std::ios_base::event ev, std::ios_base& strm, int idx)
    {
    if (ev == std::ios_base::erase_event)
        {
        try
            {
            delete static_cast<NewFormat*>(strm.pword(idx));

            strm.pword(idx) = 0;
            }
        catch (...)
            { }
        }
    else if (ev == std::ios_base::copyfmt_event)
        {
        NewFormat* old(static_cast<NewFormat*>(strm.pword(idx)));

        if (old != 0)
            {
            try
                {
                strm.pword(idx) = new NewFormat(*old);
                }
            catch (std::bad_alloc&)
                { }
            }
        }
    }
开发者ID:Ablu,项目名称:freeorion,代码行数:28,代码来源:iomanip.hpp

示例2: replace_pword

void replace_pword(std::ios_base& iob, int idx, const T& x) {
    iob.register_callback(callback<NewFormat>, idx);

    NewFormat* new_format(new NewFormat(x));
    OldFormat* old_format(static_cast<OldFormat*>(iob.pword(idx)));
    iob.pword(idx) = new_format;
    delete old_format;
}
开发者ID:ilelann,项目名称:adobe_source_libraries,代码行数:8,代码来源:iomanip.hpp

示例3: my_ios_callback

// Stream format gets copied or destroyed
static void my_ios_callback(std::ios_base::event ev, std::ios_base & s, int i)
{
	print_context *p = static_cast<print_context *>(s.pword(i));
	if (ev == std::ios_base::erase_event) {
		delete p;
		s.pword(i) = nullptr;
	} else if (ev == std::ios_base::copyfmt_event && p != nullptr)
		s.pword(i) = p->duplicate();
}
开发者ID:feelpp,项目名称:feelpp,代码行数:10,代码来源:operators.cpp

示例4: set_print_context

// Set print_context associated with stream, retain options
static void set_print_context(std::ios_base & s, const print_context & c)
{
	int i = my_ios_index();
	long flags = s.iword(i);
	if (!(flags & callback_registered)) {
		s.register_callback(my_ios_callback, i);
		s.iword(i) = flags | callback_registered;
	}
	print_context *p = static_cast<print_context *>(s.pword(i));
	unsigned options = p ? p->options : c.options;
	delete p;
	p = c.duplicate();
	p->options = options;
	s.pword(i) = p;
}
开发者ID:feelpp,项目名称:feelpp,代码行数:16,代码来源:operators.cpp

示例5: cleanup

void cleanup(std::ios_base::event evt, std::ios_base& str, int idx)
{
    if (str.iword(separatorEnabled()) && evt == std::ios_base::erase_event)
    {
        void*& p = str.pword(idx);
        delete static_cast<std::string*>(p);
        str.iword(separatorEnabled()) = false; 
    }
}
开发者ID:CCJY,项目名称:coliru,代码行数:9,代码来源:main.cpp

示例6:

void
TimeStreamFormater::setStreamInfo(std::ios_base & theStream) const {
    theStream.iword(ourIsFormatedFlagIndex) = true;
    theStream.pword(ourFormatStringIndex) = (void *) _myFormatString ;
}
开发者ID:artcom,项目名称:asl,代码行数:5,代码来源:TimeStreamFormater.cpp


注:本文中的std::ios_base::pword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。