stafconnection.cpp
来自「Software Testing Automation Framework (S」· C++ 代码 · 共 74 行
CPP
74 行
/*****************************************************************************//* Software Testing Automation Framework (STAF) *//* (C) Copyright IBM Corp. 2001 *//* *//* This software is licensed under the Common Public License (CPL) V1.0. *//*****************************************************************************/#include <errno.h>#include "STAF.h"#include "STAFUtil.h"#include "STAFConnection.h"#include "STAFException.h"STAFConnection::STAFConnection(ConnectionType conType, ConnectionMode conMode) : fConnectionType(conType), fConnectionMode(conMode){ /* Do Nothing */ }STAFConnection::~STAFConnection(){ /* Do Nothing */ }STAFString STAFConnection::readString(){ // First read in the UTF-8 data unsigned int dataSize = readUInt(); char *inputData = new char[dataSize]; read((void *)inputData, dataSize); STAFString result; try { // Indicate UTF-8 data since default is Current Code Page result = STAFString(inputData, dataSize, STAFString::kUTF8); } catch(...) { delete [] inputData; throw; } delete [] inputData; return result;}void STAFConnection::readString(STAFString &theString){ theString = readString();}void STAFConnection::writeString(const STAFString &theString){ // If it is a zero length string, simply short-circuit and write // zero-length string if (theString.length() == 0) { writeUInt(0); return; } unsigned int len; const char *buffer = theString.buffer(&len); writeUInt(len); write((void *)buffer, len);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?