本文整理汇总了C++中s4函数的典型用法代码示例。如果您正苦于以下问题:C++ s4函数的具体用法?C++ s4怎么用?C++ s4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s4函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: f
//!----------------------------------------------------------------------------------------------------
//!
//! \brief GuidewareTrackingWindow::startNaigation
//!
void GuidewareTrackingWindow::startNaigation(){
//! -----------------------------------------------------------------------
collaborativeState = "on"; //on/off
collaborativeName = this->patientHandling->getName();
collaborativeType = "navi"; //standby/normal/reconstruct/reconstructed
collaborativePath = this->patientHandling->getCTImagePath() + "navi";
QFile f(this->configuratonFilePath);
if(!f.open(QIODevice::WriteOnly | QIODevice::Text))
{
cout << "Open failed." << endl;
}
QTextStream txtOutput(&f);
QString s1(collaborativeState);
QString s2(collaborativeName);
QString s3(collaborativeType);
QString s4(collaborativePath);
txtOutput << "state:" << s1 << endl;
txtOutput << "name:" << s2 << endl;
txtOutput << "type:" << s3 << endl;
txtOutput << "path:" << s4 << endl;
f.close();
//! -----------------------------------------------------------------------
}
开发者ID:wangtseng,项目名称:piss,代码行数:31,代码来源:GuidewareTrackingWindow.cpp
示例2: capacity_test
bool capacity_test( )
{
bool rc = true;
std::string s1;
std::string s2("Hello, World!");
if( s1.capacity( ) == 0) FAIL
if( s2.size( ) > s2.capacity( ) ) FAIL
if( s1.empty( ) == false ) FAIL
if( s2.empty( ) == true ) FAIL
s2.clear( );
if( s2.empty( ) == false ) FAIL
std::string s3("Hello");
s3.resize( 2 );
if( s3.size( ) != 2 || s3 != "He" ) FAIL
s3.resize( 5, 'x' );
if( s3.size( ) != 5 || s3 != "Hexxx" ) FAIL
s3.resize( 40, 'y' );
if( s3.size( ) != 40 ||
s3 != "Hexxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" ) FAIL
std::string s4("Hello");
std::string::size_type new_s4capacity = ( 7 * s4.capacity( ) ) / 2;
s4.reserve( new_s4capacity );
if( s4.capacity( ) < new_s4capacity || s4.size( ) != 5 || s4 != "Hello" ) {
FAIL
}
return( rc );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:34,代码来源:string01.cpp
示例3: erase_test
bool erase_test( )
{
bool rc = true;
std::string s1( "Hello, World!" );
s1.erase( );
if( s1 != "" || s1.size( ) != 0 || INSANE( s1 ) ) FAIL
std::string s2( "Hello, World!" );
s2.erase( 2, 3 );
if( s2 != "He, World!" || s2.size( ) != 10 || INSANE( s2 ) ) FAIL
std::string s3( "Hello, World!" );
s3.erase( 7, 6 );
if( s3 != "Hello, " || s3.size( ) != 7 || INSANE( s3 ) ) FAIL
std::string s4( "Hello, World!" );
s4.erase( s4.begin( ) );
if( s4 != "ello, World!" || s4.size( ) != 12 || INSANE( s4 ) ) FAIL
std::string s5( "Hello, World!" );
s5.erase( s5.begin( ) + 2, s5.begin( ) + 5 );
if( s5 != "He, World!" || s5.size( ) != 10 || INSANE( s5 ) ) FAIL
return( rc );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:26,代码来源:string01.cpp
示例4: main
//===========================================================================
int main ()
{
// Define, output default constructed value
string s1("blah");
std::cout << "string 1: ";
std::cout << s1;
std::cout << "\n";
// Define, output 1 digit number
string s2("pooltable");
std::cout << "string 2: ";
std::cout << s2;
std::cout << "\n";
// Define, output 3 digit number
string s3("crazy man");
std::cout << "string 2: ";
std::cout << s3;
std::cout << "\n";
// Define, output 90 digit number
string s4("this project is really hard to understand, as a cs major i have no life.");
std::cout << "string 3: ";
std::cout << s4;
std::cout << "\n";
}
开发者ID:stakere,项目名称:CS33001,代码行数:28,代码来源:test_output.cpp
示例5: TEST
TEST(functor_call_traits, non_const_this_ref_functor) {
member_op f;
member_op const &cf = f;
functor_call_traits functor;
EXPECT_THROW(functor(f, 0l, 0.0, 0, ""), std::exception);
EXPECT_EQ(3.1415926, functor_call_traits::call(cf));
functor_call_traits::call(f);
EXPECT_EQ(5.6, functor_call_traits::call(cf));
std::string s1("hello");
char const *s2 = ", ";
std::string const s3("world");
std::string s4("!");
std::string out("some test string");
EXPECT_EQ(17, functor(f, 17));
EXPECT_EQ(
s1.size() + std::strlen(s2) + s3.size() + s4.size(),
(functor(f, s1, s2, s3, s4, out))
);
EXPECT_EQ("hello, world!", out);
typedef std::integral_constant<int, functor(f, 2, 3, 5)> c;
EXPECT_EQ(2 + 3 + 5, c::value);
EXPECT_EQ(57, functor(f, 57, true));
EXPECT_EQ(-57, functor(f, 57, false));
}
开发者ID:amidvidy,项目名称:fatal,代码行数:33,代码来源:call_traits_test.cpp
示例6: s1
void StdStringTestCase::StdConstructors()
{
wxString s1(wxT("abcdefgh")),
s2(wxT("abcdefghijklm"), 8),
s3(wxT("abcdefghijklm")),
s4(8, wxT('a'));
wxString s5(s1),
s6(s3, 0, 8),
s7(s3.begin(), s3.begin() + 8);
wxString s8(s1, 4, 8);
CPPUNIT_ASSERT_EQUAL( wxT("abcdefgh"), s1 );
CPPUNIT_ASSERT_EQUAL( s1, s2 );
CPPUNIT_ASSERT_EQUAL( wxT("aaaaaaaa"), s4 );
CPPUNIT_ASSERT_EQUAL( wxT("abcdefgh"), s5 );
CPPUNIT_ASSERT_EQUAL( s1, s6 );
CPPUNIT_ASSERT_EQUAL( s1, s7 );
CPPUNIT_ASSERT_EQUAL( wxT("efgh"), s8 );
const char *pc = s1.c_str();
CPPUNIT_ASSERT_EQUAL( "bcd", wxString(pc + 1, pc + 4) );
const wchar_t *pw = s2.c_str();
CPPUNIT_ASSERT_EQUAL( "a", wxString(pw, pw + 1) );
}
开发者ID:Metallicow,项目名称:wxWidgets,代码行数:25,代码来源:stdstrings.cpp
示例7: strStd
void StdStringTestCase::StdConversion()
{
std::string strStd("std::string value");
wxStdWideString strStdWide(L"std::wstring value");
wxString s1(strStd);
CPPUNIT_ASSERT_EQUAL( "std::string value", s1 );
wxString s2(strStdWide);
CPPUNIT_ASSERT_EQUAL( "std::wstring value", s2 );
wxString s3;
s3 = strStd;
CPPUNIT_ASSERT_EQUAL( "std::string value", s3 );
s3 = strStdWide;
CPPUNIT_ASSERT_EQUAL( "std::wstring value", s3 );
wxString s4("hello");
// wxString -> std::string conversion is only available in wxUSE_STL case,
// because it conflicts with conversion to const char*/wchar_t*:
#if wxUSE_STL
std::string s5 = s4;
CPPUNIT_ASSERT_EQUAL( "hello", s5 );
wxStdWideString s6 = s4;
CPPUNIT_ASSERT_EQUAL( "hello", s6 );
#endif
std::string s7(s4);
CPPUNIT_ASSERT( s7 == "hello" );
wxStdWideString s8(s4);
CPPUNIT_ASSERT( s8 == "hello" );
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:35,代码来源:stdstrings.cpp
示例8: createStudents
std::vector<Student> createStudents()
{
Student s1("Dimitar",
"Radenkov",
28,
"08889793457",
"[email protected]",
std::vector < int > {1, 2, 3, 5});
Student s2("Ralica",
"Vaskova",
32,
"088998899889",
"[email protected]",
std::vector < int > {4, 2, 3, 4});
Student s3("Nikol",
"Georgieva",
18,
"08989898989",
"[email protected]",
std::vector < int > {2, 2, 2, 2});
Student s4("Alexander",
"Radenkov",
19,
"08989898989",
"[email protected]",
std::vector < int > {6, 6, 6, 6});
std::vector<Student> students{ s1, s2, s3, s4 };
return students;
}
开发者ID:mitko100,项目名称:CPlusPlus,代码行数:34,代码来源:main.cpp
示例9: insert
void insert()
{
/* MemStat memStat("insert"); */
String s1("1234", 5), s2("1234");
String s3("1235", 4), s4("1232");
String s5;
insert2();
cout << "insert" << endl;
s1.insert(1, s1.cStr());
assert(s1.length() == 9);
s2.insert(1, s2);
assert(s2.length() == 8 && s2 == "11234234");
s5.insert(0, s3);
assert(s3 == s5);
s5.insert(2, "abcdef", 4);
assert(s5 == "12abcd35");
s3.insert(s3.length(), "abcd");
assert(s3 == ((String)("1235") + "abcd"));
s3 = "1234";
s3.insert(0, 'x', 5);
assert(s3 == "xxxxx1234");
s3 = "1234";
s3.insert(2, 'x', 5);
assert(s3 == "12xxxxx34");
s3 = "1234";
s3.insert(s3.length(), 'x', 5);
assert(s3 == "1234xxxxx");
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:29,代码来源:strtest.c
示例10: main
int main(void)
{
static const struct st3 a = {1, 2, 3, 4, 5, 6};
l1(100);
l2(100, 200);
l3(100, 200, 300);
l4(100, 200, 300, 400);
l5(100, 200, 300, 400, 500);
l6(100, 200, 300, 400, 500, 600);
l7(100, 200, 300, 400, 500, 600, 700);
l8(100, 200, 300, 400, 500, 600, 700, 800);
d1();
d2(43);
d3(100, 200);
d4(a);
d5('a', 43, a);
d6('a', 1);
c1(44);
c2(100, 'a', 3.4);
c3(200, 2.777, 'q');
c4(200, 1);
c5(1.1, 2.2);
c6(1.23, 45.6);
c7('z', 0x200);
a1('a');
a2(10);
a3(20);
a4(102030405060LL);
b1('a', 20);
b2(30, 'b');
b3(10, 20, 30, 40, 50, 60);
s1(sx);
s1p(&sx);
s2(sy);
s3(sz);
s4(sq);
s5(sa);
s6(sb);
r1();
r3();
r4();
q1(200, sx);
q2(300, 't', sx);
q3(400, 410, sy);
q4(500, 510, sq);
q5(600, 610, 'z', 'q', sq);
real1("fresh air");
real2();
return 0;
}
开发者ID:jkkm,项目名称:latrace,代码行数:60,代码来源:test1.c
示例11: compare
void compare()
{
/* MemStat memStat("compare"); */
String s1("1234", 5), s2("1234");
String s3("1235", 5), s4("1232");
String s5;
cout << "compare" << endl;
assert(s1.compare(s2) != 0);
assert(compare(s1,s2) != 0);
assert(s2.compare(s2) == 0);
assert(s2.compare("12345", 4) == 0);
assert(s1.compare(s3) < 0);
assert(compare(s2, s3) < 0);
assert(compare(s2, "1235") < 0);
assert(compare("1235", s2) > 0);
assert(s1.compare(s4) > 0);
assert(s2.compare(s5) > 0);
assert(s5.length() == 0);
assert(s5.compare("") == 0);
assert(compare(s5,"") == 0);
assert(compare("",s5) == 0);
assert(s1 != "1234");
assert(s2 == "1234");
assert("1234" == s2);
assert("1234" != s1);
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:27,代码来源:strtest.c
示例12: main
int main()
{
char text[] = "world";
String s0;
String s1("hello");
String s2(s0);
String s3 = s1;
String s4(text);
s2 = s1;
foo(s1);
bar(s1);
foo("temporary");
bar("temporary");
String s5 = baz();
std::vector<String> svec;
svec.reserve(8);
svec.push_back(s0);
svec.push_back(s1);
svec.push_back(s2);
svec.push_back(s3);
svec.push_back(s4);
svec.push_back(s5);
svec.push_back(baz());
svec.push_back("good job");
for (const auto &s : svec) {
std::cout << s.c_str() << std::endl;
}
}
开发者ID:ceye1992,项目名称:learn,代码行数:32,代码来源:13.48.cpp
示例13: ReadFilterData
void ReadFilterData(bool reload)
{
static bool loaded = false;
if (!loaded || reload)
{
loaded = true;
QFile f1("berichten/forbidden_sentences.txt");
QFile f2("berichten/forbidden_start.txt");
QFile f3("berichten/forbidden_sentences_ai.txt");
QFile f4("berichten/forbidden_start_ai.txt");
f1.open(QIODevice::ReadOnly | QIODevice::Text);
f2.open(QIODevice::ReadOnly | QIODevice::Text);
f3.open(QIODevice::ReadOnly | QIODevice::Text);
f4.open(QIODevice::ReadOnly | QIODevice::Text);
QTextStream s1(&f1);
QTextStream s2(&f2);
QTextStream s3(&f3);
QTextStream s4(&f4);
disallowed_contents = s1.readAll().split('\n');
disallowed_begins = s2.readAll().split('\n');
disallowed_contents_ai = s3.readAll().split('\n');
disallowed_begins_ai = s4.readAll().split('\n');
}
}
开发者ID:het-gekke-robotje,项目名称:pa-chatbot-qt-v4.2,代码行数:28,代码来源:PAChatClientFilter.cpp
示例14: test
void test() {
Pboom boom;
StringMetBits s1("alfa");
StringMetBits s2("beta");
StringMetBits s3("delt");
StringMetBits s4("jaja");
StringMetBits s5("baby");
boom.insert(s1);
boom.insert(s1);
boom.insert(s2);
boom.insert(s2);
boom.insert(s2);
boom.insert(s3);
boom.insert(s4);
boom.insert(s5);
boom.insert(s5);
std::cout << s1 << ": " << boom.get(s1) << std::endl;
std::cout << s2 << ": " << boom.get(s2) << std::endl;
std::cout << s3 << ": " << boom.get(s3) << std::endl;
std::cout << s4 << ": " << boom.get(s4) << std::endl;
std::cout << s5 << ": " << boom.get(s5) << std::endl;
}
开发者ID:ahluntang,项目名称:tiwi-algoritmen,代码行数:30,代码来源:main.cpp
示例15: TEST
TEST(ArrayTest, getNumRows) {
TwoDArray<int> i4(10, 5, 42);
TwoDArray<double> d4(2, 9, 9.9);
TwoDArray<std::string> s4(6, 8, "e");
EXPECT_EQ(10, i4.access(8,2));
EXPECT_EQ(2, d4.access(0,0));
EXPECT_EQ(6, s4.access(5,7));
}
开发者ID:mkindt,项目名称:2dArrays,代码行数:8,代码来源:array_gtest.cpp
示例16: insert_test
bool insert_test( )
{
bool rc = true;
std::string s0( "INSERTED" );
std::string s1( "Hello, World!" );
s1.insert( 2, s0 );
if( s1 != "HeINSERTEDllo, World!" || s1.size( ) != 21 || INSANE( s1 ) ) {
FAIL
}
std::string s2( "Hello, World!" );
s2.insert( 0, s0 );
if( s2 != "INSERTEDHello, World!" || s2.size( ) != 21 || INSANE( s2 ) ) {
FAIL
}
std::string s3( "Hello, World!" );
s3.insert( 13, s0 );
if( s3 != "Hello, World!INSERTED" || s3.size( ) != 21 || INSANE( s3 ) ) {
FAIL
}
std::string s4( "Hello, World!" );
s4.insert( 0, s0, 2, 2 );
if( s4 != "SEHello, World!" || s4.size( ) != 15 || INSANE( s4 ) ) {
FAIL
}
std::string s5( "Hello, World!" );
s5.insert( 0, s0, 2, 128 );
if( s5 != "SERTEDHello, World!" || s5.size( ) != 19 || INSANE( s5 ) ) {
FAIL
}
// Do multiple insertions to verify reallocations.
// This should probably also be done for the other insert methods as well.
std::string s6( "Hello" );
char input = 'a';
for( int i = 0; i < 10; ++i ) {
std::string::iterator p = s6.insert( s6.begin( ), input );
if( *p != input ) FAIL;
if( s6.size( ) != 6 + i ) FAIL;
if( INSANE( s6 ) ) FAIL;
++input;
}
if( s6 != "jihgfedcbaHello" ) FAIL;
std::string s7( "Hello, World!" );
s7.insert( s7.end( ), 3, 'z' );
if( s7 != "Hello, World!zzz" || s7.size( ) != 16 || INSANE( s7 ) ) {
FAIL
}
// Need to test other insert methods.
return( rc );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:58,代码来源:string01.cpp
示例17: assign_test
bool assign_test( )
{
bool rc = true;
std::string s1( 5, 'x' );
const char *shrt_string = "Shorty";
const char *long_string = "This string is longer than 8 characters";
const std::string s2( shrt_string );
const std::string s3( long_string );
std::string s4( 5, 'x' );
std::string s5( 5, 'x' );
std::string s6( 5, 'x' );
std::string s7( 5, 'x' );
std::string s8( 5, 'x' );
std::string s9( 5, 'x' );
const char *raw = "This is a very, very long string";
s1 = s2;
if( s1.size( ) != 6 || s1 != shrt_string || INSANE( s1 ) ) FAIL
s1 = s3;
if( s1.size( ) != 39 || s1 != long_string || INSANE( s1 ) ) FAIL
s4 = shrt_string;
if( s4.size( ) != 6 || s4 != shrt_string || INSANE( s4 ) ) FAIL
s4 = long_string;
if( s4.size( ) != 39 || s4 != long_string || INSANE( s4 ) ) FAIL
s5 = 'y';
if( s5.size( ) != 1 || s5 != "y" || INSANE( s5 ) ) FAIL
s6.assign( s3, 35, 5 );
if( s6.size( ) != 4 || s6 != "ters" || INSANE( s6 ) ) FAIL
s6.assign( s3, 5, 16 );
if( s6.size( ) != 16 || s6 != "string is longer" || INSANE( s6 ) ) FAIL
s7.assign( raw, 4 );
if( s7.size( ) != 4 || s7 != "This" || INSANE( s7 ) ) FAIL
s7.assign( raw, 10 );
if( s7.size( ) != 10 || s7 != "This is a " || INSANE( s7 ) ) FAIL
s8.assign( "Shorty" );
if( s8.size( ) != 6 || s8 != "Shorty" || INSANE( s8 ) ) FAIL
s8.assign( long_string );
if( s8.size( ) != 39 || s8 != long_string || INSANE( s8 ) ) FAIL
s9.assign( 7, 'x' );
if( s9.size( ) != 7 || s9 != "xxxxxxx" || INSANE( s9 ) ) FAIL
s9.assign( 8, 'y' );
if( s9.size( ) != 8 || s9 != "yyyyyyyy" || INSANE( s9 ) ) FAIL
return( rc );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:57,代码来源:string01.cpp
示例18: s2
bool TestExtString::test_stringdata() {
// None of these should assert.
StackStringData s1;
String s2(StringData::MaxSmallSize / 2, ReserveString);
String s3(StringData::MaxSmallSize * 2, ReserveString);
String s4(StringData::MaxSmallSize * 2, ReserveString);
s4.mutableSlice().ptr[0] = 'a';
return Count(true);
}
开发者ID:BauerBox,项目名称:hiphop-php,代码行数:9,代码来源:test_ext_string.cpp
示例19: main
int main()
{
// Step(a) - construct a triangular face.
Arrangement_2 arr;
Segment_2 s1(Point_2(667, 1000), Point_2(4000, 5000));
Segment_2 s2(Point_2(4000, 0), Point_2(4000, 5000));
Segment_2 s3(Point_2(667, 1000), Point_2(4000, 0));
Halfedge_handle e1 = arr.insert_in_face_interior(s1, arr.unbounded_face());
Vertex_handle v1 = e1->source();
Vertex_handle v2 = e1->target();
Halfedge_handle e2 = arr.insert_from_right_vertex(s2, v2);
Vertex_handle v3 = e2->target();
arr.insert_at_vertices(s3, v3, v1);
// Step (b) - create additional two faces inside the triangle.
Point_2 p1(4000, 3666), p2(4000, 1000);
Segment_2 s4(Point_2(4000, 5000), p1);
Segment_2 s5(p1, p2);
Segment_2 s6(Point_2(4000, 0), p2);
Halfedge_handle e4 = arr.split_edge(e2, s4, Segment_2(Point_2(4000, 0), p1));
Vertex_handle w1 = e4->target();
Halfedge_handle e5 = arr.split_edge(e4->next(), s5, s6);
Vertex_handle w2 = e5->target();
Halfedge_handle e6 = e5->next();
Segment_2 s7(p1, Point_2(3000, 2666));
Segment_2 s8(p2, Point_2(3000, 1333));
Segment_2 s9(Point_2(3000, 2666), Point_2(2000, 1666));
Segment_2 s10(Point_2(3000, 1333), Point_2(2000, 1666));
Segment_2 s11(Point_2(3000, 1333), Point_2(3000, 2666));
Halfedge_handle e7 = arr.insert_from_right_vertex(s7, w1);
Vertex_handle v4 = e7->target();
Halfedge_handle e8 = arr.insert_from_right_vertex(s8, w2);
Vertex_handle v5 = e8->target();
Vertex_handle v6 =
arr.insert_in_face_interior(Point_2(2000, 1666), e8->face());
arr.insert_at_vertices(s9, v4, v6);
arr.insert_at_vertices(s10, v5, v6);
arr.insert_at_vertices(s11, v4, v5);
// Step(c) - remove and merge faces to form a single hole in the traingle.
arr.remove_edge(e7);
arr.remove_edge(e8);
e5 = arr.merge_edge(e5, e6, Segment_2(e5->source()->point(),
e6->target()->point()));
e2 = arr.merge_edge(e4, e5, s2);
print_arrangement(arr);
return 0;
}
开发者ID:CGAL,项目名称:releases,代码行数:56,代码来源:edge_manipulation.cpp
示例20: SendAudioFrame
void SendAudioFrame(const unsigned char* audbuf, unsigned framesize)
{
CheckBegin();
//fprintf(stderr, "Writing 01wb of %u bytes\n", framesize);
const unsigned char header[] = { s4("01wb"), u32(framesize) };
FlushWrite(avifp, header, sizeof(header));
FlushWrite(avifp, audbuf, framesize);
}
开发者ID:jamesread,项目名称:vba-linux,代码行数:10,代码来源:nesvideos-piece.cpp
注:本文中的s4函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论