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


C++ setp函数代码示例

本文整理汇总了C++中setp函数的典型用法代码示例。如果您正苦于以下问题:C++ setp函数的具体用法?C++ setp怎么用?C++ setp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setb

filebuf::filebuf(int f)
{
    xfd = f;        // assumed to be valid
    opened = 1;     // unless we can find out otherwise
    mode = 0;       // unless we can find out otherwise
    last_seek = 0;
    char* p = new char[B_size];
    if( p )
        {
        setb(p, p+B_size, 1);   // ~streambuf() will delete buffer
        setp(p+4, p+4);
        setg(p, p+4, p+4);
        }
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:14,代码来源:FSBCTR2.CPP

示例2: setb

filebuf::filebuf()
{
    xfd = EOF;
    mode = 0;
    opened = 0;
    last_seek = 0;
    char* p = new char[B_size];
    if( p )
    {
        setb(p, p+B_size, 1);   // ~streambuf() will delete buffer
        setp(p+4, p+4);
        setg(p, p+4, p+4);
    }
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:14,代码来源:fsbctr1.cpp

示例3: setg

void IOBuffer::init(std::size_t bufferSize, bool extend)
{
    _ibufferSize = bufferSize + 4;
    _ibuffer = 0;
    _obufferSize = bufferSize;
    _obuffer = 0;
    _oextend = extend;

    if( gptr() )
        setg(_ibuffer, _ibuffer + _ibufferSize, _ibuffer + _ibufferSize);

    if( pptr() )
        setp(_obuffer, _obuffer + _obufferSize);
}
开发者ID:3Nigma,项目名称:frayon,代码行数:14,代码来源:IOBuffer.cpp

示例4: log_debug

int Md5streambuf::sync()
{
  if (pptr() != pbase())
  {
    // konsumiere Zeichen aus dem Puffer
    log_debug("process " << (pptr() - pbase()) << " bytes of data");
    cxxtools_MD5Update(context, (const unsigned char*)pbase(), pptr() - pbase());

    // leere Ausgabepuffer
    setp(buffer, buffer + bufsize);
  }

  return 0;
}
开发者ID:913862627,项目名称:cxxtools,代码行数:14,代码来源:md5stream.cpp

示例5: main

int
main (void)
{
  int (*p) (void);
  int  i;

  for (i = 0; i < 10; i ++)
    {
	setp (&p, i);
	p ();
    }
  
  return 0;
}
开发者ID:ds2dev,项目名称:gcc,代码行数:14,代码来源:indir-call-prof_0.c

示例6: pptr

	int lowpanstream::overflow(int c)
	{
		char *ibegin = out_buf_;
		char *iend = pptr();

		IBRCOMMON_LOGGER_DEBUG(10) << "lowpanstream::overflow"<< IBRCOMMON_LOGGER_ENDL;

		// mark the buffer as free
		setp(out_buf_ + 1, out_buf_ + BUFF_SIZE - 1);

		if (!std::char_traits<char>::eq_int_type(c, std::char_traits<char>::eof()))
		{
			*iend++ = std::char_traits<char>::to_char_type(c);
		}

		// bytes to send
		size_t bytes = (iend - ibegin);

		// if there is nothing to send, just return
		if (bytes == 0)
		{
			IBRCOMMON_LOGGER_DEBUG(10) << "lowpanstream::overflow() nothing to sent" << IBRCOMMON_LOGGER_ENDL;
			return std::char_traits<char>::not_eof(c);
		}

		//FIXME: Should we write in the segment position here?
		out_buf_[0] = 0x07 & out_seq_num_;
		out_buf_[0] |= _out_stat;

		out_seq_num_global++;
		out_seq_num_ = (out_seq_num_ + 1) % 8;

		IBRCOMMON_LOGGER_DEBUG(10) << "lowpanstream send segment " << (int)out_seq_num_ << " / " << out_seq_num_global << IBRCOMMON_LOGGER_ENDL;

		// Send segment to CL, use callback interface
		callback.send_cb(out_buf_, bytes, _address);

		if (_out_stat & SEGMENT_LAST)
		{
			// reset outgoing status byte and sequence number
			_out_stat = SEGMENT_FIRST;
			out_seq_num_ = 0;
		}
		else
		{
			_out_stat = SEGMENT_MIDDLE;
		}

		return std::char_traits<char>::not_eof(c);
}
开发者ID:Stefan-Schmidt,项目名称:ibrcommon,代码行数:50,代码来源:lowpanstream.cpp

示例7: switch

std::ios::pos_type
Charbuf::seekoff(std::ios::off_type off, std::ios_base::seekdir dir,
    std::ios_base::openmode which)
{
    std::ios::pos_type pos;
    char *cpos = nullptr;
    if (which & std::ios_base::in)
    {
        switch (dir)
        {
        case std::ios::beg:
            cpos = eback() + off - m_bufOffset;
            break;
        case std::ios::cur:
            cpos = gptr() + off;
            break;
        case std::ios::end:
            cpos = egptr() - off;
            break;
        default:
            break;  // Should never happen.
        }
        if (cpos < eback() || cpos > egptr())
            return -1;
        setg(eback(), cpos, egptr());
        pos = cpos - eback();
    }
    if (which & std::ios_base::out)
    {
        switch (dir)
        {
        case std::ios::beg:
            cpos = m_buf + off - m_bufOffset;
            break;
        case std::ios::cur:
            cpos = pptr() + off;
            break;
        case std::ios::end:
            cpos = egptr() - off;
            break;
        default:
            break;  // Should never happen.
        }
        if (cpos < m_buf || cpos > epptr())
            return -1;
        setp(cpos, epptr());
        pos = cpos - m_buf;
    }
    return pos;
}
开发者ID:rskelly,项目名称:PDAL,代码行数:50,代码来源:Charbuf.cpp

示例8: setp

int Socket::sync() {
    if(getOutputBufferSize() <= 0) //No output buffer
        return EOF;

    if(pptr() == pbase()) //Allready in sync
        return 0;

    try {
        setp(pbase(), pptr()+send(pbase(), pptr()-pbase()));
        return 0;
    } catch(Exception err) {
        return EOF;
    }
}
开发者ID:darcyg,项目名称:netLink,代码行数:14,代码来源:Socket.cpp

示例9: basic_socket_streambuf

 /// Move-construct a basic_socket_streambuf from another.
 basic_socket_streambuf(basic_socket_streambuf&& other)
   : detail::socket_streambuf_io_context(other),
     basic_socket<Protocol ASIO_SVC_TARG>(std::move(other.socket())),
     ec_(other.ec_),
     expiry_time_(other.expiry_time_)
 {
   get_buffer_.swap(other.get_buffer_);
   put_buffer_.swap(other.put_buffer_);
   setg(other.eback(), other.gptr(), other.egptr());
   setp(other.pptr(), other.epptr());
   other.ec_ = asio::error_code();
   other.expiry_time_ = max_expiry_time();
   other.init_buffers();
 }
开发者ID:Dagarman,项目名称:mame,代码行数:15,代码来源:basic_socket_streambuf.hpp

示例10: pptr

int PAsteriskLog::Buffer::overflow(int c)
{
	if (pptr() >= epptr()) {
		int ppos = pptr() - pbase();
		char *newptr = string.GetPointer(string.GetSize() + 2000);
		setp(newptr, newptr + string.GetSize() - 1);
		pbump(ppos);
	}
	if (c != EOF) {
		*pptr() = (char)c;
		pbump(1);
	}
	return 0;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:14,代码来源:ast_h323.cpp

示例11: setp

 int streambuf::sync ()
 {
         // Ouput all contents of put buffer.
     const std::streamsize count = myChannel.put(
         reinterpret_cast<const uint8*>(pbase()),
         std::streamsize(pptr()-pbase())
         );
     
         // Adjust put buffer pointers.
     setp(pptr(),epptr());
     
         // Indicate status (failure/success).
     return ((count == 0)? 0 : 1);
 }
开发者ID:AndreLouisCaron,项目名称:w32,代码行数:14,代码来源:streambuf.cpp

示例12: return

  streampos strstreambuf::seekoff( streamoff offset,
                                   ios::seekdir direction,
                                   int mode ) {

    streampos  newpos;
    char      *endget;
    char      *pos;

    mode &= (ios::in | ios::out);
    if( (mode == 0) ||
      ( (direction==ios::cur) && (mode == (ios::in | ios::out)) ) ) {
        return( EOF );
    }

    __lock_it( __b_lock );

    // Move the get pointer:
    if( mode & ios::in ) {
        endget = pptr();
        if( endget == NULL || endget < egptr() ) {
            endget = egptr();
        }
        newpos = __get_position( offset, direction, eback(), gptr(), egptr(), endget );
        if( newpos != EOF ) {

            // If the seek went beyond the end of the get area, extend the
            // get area to include the characters in the put area.
            pos = eback() + newpos;
            if( pos > egptr() ) {
                setg( eback(), pos, epptr() );
            } else {
                setg( eback(), pos, egptr() );
            }
        }
    }

    if( mode & ios::out ) {
        // Move the put pointer:
        newpos = __get_position( offset, direction, pbase(), pptr(), epptr(), epptr() );
        if( newpos != EOF ) {
            setp( pbase(), epptr() );
            pbump( newpos );
            if( newpos > __minbuf_size ) {
                __minbuf_size = (int)newpos;
            }
        }
    }
    return( newpos );
  }
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:49,代码来源:ssfseeko.cpp

示例13: sync

    virtual int sync()
    {
        if (pbase() != pptr())
        {
            // Replace '\n' at the end of the message with '\0'
            *(pptr() - 1) = '\0';

            // Call the function in sf.pyx that handles new messages
            set_error_message(pbase());

            setp(pbase(), epptr());
        }

        return 0;
    }
开发者ID:acgessler,项目名称:pysfml2-cython,代码行数:15,代码来源:hacks.cpp

示例14: output

ocryptostreambuf::ocryptostreambuf(std::streambuf* out, const crypto_key& key, const crypto_iv& iv, int enc)
  :ctx(EVP_CIPHER_CTX_new()),
   output(*out)
{
  if (!ctx)
    return;

  if (1 != EVP_CipherInit_ex(ctx, EVP_aes_256_cbc(), NULL, key.data(), iv.data(), enc))
    {
      EVP_CIPHER_CTX_free(ctx);
      ctx = NULL;
    }

  setp(in.data(),in.data()+in.size());
}
开发者ID:jklof,项目名称:cryptostreambuf,代码行数:15,代码来源:cryptostreambuf.cpp

示例15: systembuf

    /**
     * Constructs a new systembuf for the given file handle.
     *
     * This constructor creates a new systembuf object that reads or
     * writes data from/to the \a h native file handle. This handle
     * is \b not owned by the created systembuf object; the code
     * should take care of it externally.
     *
     * This class buffers input and output; the buffer size may be
     * tuned through the \a bufsize parameter, which defaults to 8192
     * bytes.
     *
     * \see pistream and postream
     */
    explicit systembuf(handle_type h, std::size_t bufsize = 8192)
        : handle_(h),
          bufsize_(bufsize),
          read_buf_(new char[bufsize]),
          write_buf_(new char[bufsize])
    {
#if defined(BOOST_POSIX_API)
        BOOST_ASSERT(handle_ >= 0);
#elif defined(BOOST_WINDOWS_API)
        BOOST_ASSERT(handle_ != INVALID_HANDLE_VALUE);
#endif
        BOOST_ASSERT(bufsize_ > 0);

        setp(write_buf_.get(), write_buf_.get() + bufsize_);
    }
开发者ID:daniperez,项目名称:magrit,代码行数:29,代码来源:systembuf.hpp


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