本文整理汇总了C++中StringBuffer::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::GetString方法的具体用法?C++ StringBuffer::GetString怎么用?C++ StringBuffer::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseField
Field SchemaHelper::parseField(const rapidjson::Document &data, int index)
{
Field field = std::make_shared<SchemaField>();
field->index = index;
field->name = getJSONString(data, "name");
field->type = getJSONString(data, "type");
field->geometry_type = getJSONString(data, "geometry_type");
field->nullable = getJSONBool(data, "nullable");
field->related_to = getJSONLong(data, "related_to", -1);
field->max_length = getJSONInt(data, "max_length", -1);
field->default_value = getJSONString(data, "default");
StringBuffer buffer;
PrettyWriter<StringBuffer> writer(buffer);
data.Accept(writer);
field->json = buffer.GetString();
if(field->name == "amigo_id")
{
field->unique = true;
}
return field;
}
示例2: writer
TEST(Writer, ValidateEncoding)
{
{ StringBuffer buffer;
Writer<StringBuffer, UTF8<>, UTF8<>, CrtAllocator, kWriteValidateEncodingFlag> writer(buffer);
writer.StartArray();
EXPECT_TRUE(writer.String("\x24")); // Dollar sign U+0024
EXPECT_TRUE(writer.String("\xC2\xA2")); // Cents sign U+00A2
EXPECT_TRUE(writer.String("\xE2\x82\xAC")); // Euro sign U+20AC
EXPECT_TRUE(writer.String("\xF0\x9D\x84\x9E")); // G clef sign U+1D11E
writer.EndArray();
EXPECT_STREQ("[\"\x24\",\"\xC2\xA2\",\"\xE2\x82\xAC\",\"\xF0\x9D\x84\x9E\"]", buffer.GetString());
}
// Fail in decoding invalid UTF-8 sequence http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
{ StringBuffer buffer;
Writer<StringBuffer, UTF8<>, UTF8<>, CrtAllocator, kWriteValidateEncodingFlag> writer(buffer);
writer.StartArray();
EXPECT_FALSE(writer.String("\xfe"));
EXPECT_FALSE(writer.String("\xff"));
EXPECT_FALSE(writer.String("\xfe\xfe\xff\xff"));
writer.EndArray();
}
}
示例3: s
TEST(SchemaValidatingWriter, Simple) {
Document sd;
sd.Parse("{\"type\":\"string\",\"minLength\":2,\"maxLength\":3}");
SchemaDocument s(sd);
Document d;
StringBuffer sb;
Writer<StringBuffer> writer(sb);
GenericSchemaValidator<SchemaDocument, Writer<StringBuffer> > validator(s, writer);
d.Parse("\"red\"");
EXPECT_TRUE(d.Accept(validator));
EXPECT_TRUE(validator.IsValid());
EXPECT_STREQ("\"red\"", sb.GetString());
sb.Clear();
validator.Reset();
d.Parse("\"ABCD\"");
EXPECT_FALSE(d.Accept(validator));
EXPECT_FALSE(validator.IsValid());
EXPECT_TRUE(validator.GetInvalidSchemaPointer() == SchemaDocument::PointerType(""));
EXPECT_TRUE(validator.GetInvalidDocumentPointer() == SchemaDocument::PointerType(""));
}
示例4: bis
TEST(Document, ParseStream_AutoUTFInputStream) {
// Any -> UTF8
FILE* fp = OpenEncodedFile("utf32be.json");
char buffer[256];
FileReadStream bis(fp, buffer, sizeof(buffer));
AutoUTFInputStream<unsigned, FileReadStream> eis(bis);
Document d;
d.ParseStream<0, AutoUTF<unsigned> >(eis);
EXPECT_FALSE(d.HasParseError());
fclose(fp);
char expected[] = "I can eat glass and it doesn't hurt me.";
Value& v = d["en"];
EXPECT_TRUE(v.IsString());
EXPECT_EQ(sizeof(expected) - 1, v.GetStringLength());
EXPECT_EQ(0, StrCmp(expected, v.GetString()));
// UTF8 -> UTF8 in memory
StringBuffer bos;
Writer<StringBuffer> writer(bos);
d.Accept(writer);
{
// Condense the original file and compare.
FILE *fp = OpenEncodedFile("utf8.json");
FileReadStream is(fp, buffer, sizeof(buffer));
Reader reader;
StringBuffer bos2;
Writer<StringBuffer> writer(bos2);
reader.Parse(is, writer);
EXPECT_EQ(bos.GetSize(), bos2.GetSize());
EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize()));
}
}
示例5: is
TEST(test_emws_seger, test_emws_seger_test_save) {
el::Logger *testLogger = el::Loggers::getLogger("emws_seger_unittest");
using namespace std;
using namespace rapidjson;
const string filename = "./conf/emws_config.json";
FILE* fp = fopen(filename.data(), "rb");
char readBuffer[65536];
FileReadStream is(fp, readBuffer, sizeof(readBuffer));
Document config;
config.ParseStream(is);
fclose(fp);
StringBuffer buffer;
PrettyWriter<StringBuffer> writer(buffer);
config.Accept(writer);
testLogger->info("=====parameters====\n%v", buffer.GetString());
testLogger->info("initial model ...");
string const model_name = "emws";
base_seger *seger = base_seger::create_seger(config, model_name);
string const model_path = utf8_io::gen_model_path(model_name, "./model");
testLogger->info("save model to %v\n\n", model_path);
// save model
bool ret = seger->save(model_path);
EXPECT_EQ(ret, true);
// load model
testLogger->info("load model ...");
base_seger *loaded_seger = base_seger::load(model_path, model_name);
testLogger->info("train ...");
loaded_seger->train();
testLogger->info("train done");
}
示例6: SaveToFile
bool FileUtil::SaveToFile(const Serializable::Ptr &source, const std::string &filePath)
{
using namespace rapidjson;
std::ofstream output(filePath);
if (output)
{
StringBuffer sb;
PrettyWriter<StringBuffer> writer(sb);
if (!source->Save(&writer))
{
LOGE << "Serialization failed!";
return false;
}
output << sb.GetString();
output.close();
LOGD << filePath << " successfully serialized!";
return true;
}
return false;
}
示例7: render_GET
void FoldersService::render_GET(const http_request& req, http_response** res)
{
Document respjsondoc;
respjsondoc.SetArray();
string strid = req.get_arg("id");
HisDevFolder* folder = root->GetFolder();
string path = req.get_path();
if(!strid.empty())
{
CUUID id = CUUID::Parse(strid);
folder = dynamic_cast<HisDevFolder*>(folder->Find(id));
}
if (path.find("/api/folders")!=string::npos)
{
if (folder!=NULL)
{
FoldersToJson(folder,respjsondoc);
}
}
else if (path.find("/api/folder")!=string::npos)
{
if (folder!=NULL)
{
FolderToJson(folder,respjsondoc);
}
}
StringBuffer buffer;
PrettyWriter<StringBuffer> wr(buffer);
respjsondoc.Accept(wr);
std::string json = buffer.GetString();
*res = new http_string_response(json, 200, "application/json");
}
示例8: SetInfo
int ytopen_sdk::SetInfo(rapidjson::Document &result, const string& person_id, const string& person_name, const string& tag)
{
std::stringstream ss;
ss<<host<<"/youtu/api/setinfo";
string addr;
addr.assign(ss.str());
string req;
string rsp;
StringBuffer sbuffer;
Writer<StringBuffer> writer(sbuffer);
writer.StartObject();
writer.String("app_id"); writer.String(app_id.c_str());
writer.String("person_id"); writer.String(person_id.c_str());
writer.String("person_name"); writer.String(person_name.c_str());
writer.String("tag"); writer.String(tag.c_str());
writer.EndObject();
req = sbuffer.GetString();
int ret = curl_method(addr, req, rsp);
if(ret == 0) {
result.Parse<rapidjson::kParseStopWhenDoneFlag>(rsp.c_str());
if(result.HasParseError()) {
std::cout << "RapidJson parse error " << result.GetParseError() << endl;
return -1;
}
}else {
return -1;
}
return 0;
}
示例9: serializer
BOOST_FIXTURE_TEST_CASE( mo_serialize , BaseFixture ) {
MOSerializer serializer(&db);
StringBuffer buffer;
Writer<StringBuffer> writer(buffer);
shared_ptr<ObjectInstance> oi =
shared_ptr<ObjectInstance>(new ObjectInstance(1));
oi->setUInt64(1, 42);
oi->addString(2, "test1");
oi->addString(2, "test2");
URI uri("/");
client1->put(1, uri, oi);
shared_ptr<ObjectInstance> oi2 =
shared_ptr<ObjectInstance>(new ObjectInstance(2));
oi2->setInt64(4, -42);
URI uri2("/class2/-42");
client1->put(2, uri2, oi2);
client1->addChild(1, uri, 3, 2, uri2);
shared_ptr<ObjectInstance> oi3 =
shared_ptr<ObjectInstance>(new ObjectInstance(2));
oi3->setInt64(4, -84);
URI uri3("/class2/-84");
client1->put(2, uri3, oi3);
client1->addChild(1, uri, 3, 2, uri3);
writer.StartObject();
writer.String("result");
writer.StartObject();
writer.String("policy");
writer.StartArray();
serializer.serialize(1, uri, *client1, writer);
writer.EndArray();
writer.String("prr");
writer.Uint(3600);
writer.EndObject();
writer.String("id");
writer.Uint(42);
writer.EndObject();
//std::cout << buffer.GetString() << std::endl;
Document d;
d.Parse(buffer.GetString());
const Value& result = d["result"];
BOOST_CHECK(result.IsObject());
const Value& prr = result["prr"];
BOOST_CHECK(prr.IsUint());
BOOST_CHECK_EQUAL(3600, prr.GetInt());
const Value& policy = result["policy"];
BOOST_CHECK(policy.IsArray());
BOOST_CHECK_EQUAL(3, policy.Size());
const Value& mo1 = policy[SizeType(0)];
BOOST_CHECK_EQUAL("class1", const_cast<char *>(mo1["subject"].GetString()));
BOOST_CHECK_EQUAL("/", const_cast<char *>(mo1["uri"].GetString()));
const Value& mo1props = mo1["properties"];
BOOST_CHECK(mo1props.IsArray());
BOOST_CHECK_EQUAL(2, mo1props.Size());
const Value& mo1children = mo1["children"];
BOOST_CHECK(mo1children.IsArray());
BOOST_CHECK_EQUAL(2, mo1children.Size());
for (SizeType i = 0; i < mo1children.Size(); ++i) {
const Value& child = mo1children[i];
BOOST_CHECK(child.IsString());
BOOST_CHECK(std::string("/class2/-42") == child.GetString() ||
std::string("/class2/-84") == child.GetString());
const Value& mo2 = policy[SizeType(i+1)];
BOOST_CHECK(std::string("/class2/-42") == mo2["uri"].GetString() ||
std::string("/class2/-84") == mo2["uri"].GetString());
BOOST_CHECK_EQUAL("class2", const_cast<char *>(mo2["subject"].GetString()));
BOOST_CHECK_EQUAL("class1", const_cast<char *>(mo2["parent_subject"].GetString()));
BOOST_CHECK_EQUAL("/", const_cast<char *>(mo2["parent_uri"].GetString()));
BOOST_CHECK_EQUAL("class2", const_cast<char *>(mo2["parent_relation"].GetString()));
const Value& mo2props = mo2["properties"];
BOOST_CHECK(mo2props.IsArray());
BOOST_CHECK_EQUAL(1, mo2props.Size());
const Value& mo2children = mo2["children"];
BOOST_CHECK(mo2children.IsArray());
BOOST_CHECK_EQUAL(0, mo2children.Size());
}
}
示例10: s
TEST(Writer, Compact) {
StringStream s("{ \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null, \"i\":123, \"pi\": 3.1416, \"a\":[1, 2, 3] } ");
StringBuffer buffer;
Writer<StringBuffer> writer(buffer);
buffer.ShrinkToFit();
Reader reader;
reader.Parse<0>(s, writer);
EXPECT_STREQ("{\"hello\":\"world\",\"t\":true,\"f\":false,\"n\":null,\"i\":123,\"pi\":3.1416,\"a\":[1,2,3]}", buffer.GetString());
EXPECT_EQ(77u, buffer.GetSize());
EXPECT_TRUE(writer.IsComplete());
}
示例11: NodeBtHandler
//.........这里部分代码省略.........
cout << refreshRateCounter << endl;
} // BT Publisher kısmının sonu
// Sunucu tarafından gönderilen Matlab komutlarına Subscribe olunuyor
else
{
status = serverReqReader->take(serverReqSeq,
infoSeq,
LENGTH_UNLIMITED,
ANY_SAMPLE_STATE,
ANY_VIEW_STATE,
ANY_INSTANCE_STATE);
checkStatus(status, "severReqDataReader::read");
for (DDS::ULong j = 0; j < serverReqSeq.length(); j++)
{
if(infoSeq[j].valid_data)
{
cout << "=== [Subscriber] message received :" << endl;
cout << " Received Request Message : "
<< serverReqSeq[j].request << endl;
cout << " Received RequestID : \""
<< serverReqSeq[j].requestID << "\"" << endl;
// Rapidjson yapılandırıcısı yaratılıyor
Document d;
if(d.Parse(serverReqSeq[j].request).HasParseError())
cout << " Parsing Error!" << endl;
StringBuffer nodeIdBuffer;
Writer<StringBuffer> nodeIdWriter(nodeIdBuffer);
d["NodeID"].Accept(nodeIdWriter);
string tempNodeId = nodeIdBuffer.GetString();
// Subscribe olunan mesajın düğüme ait olup olmadığı kontrol ediliyor
if (tempNodeId == "\"SensDug13\"")
{
StringBuffer buffer;
Value::ConstMemberIterator itr = d.FindMember("SetRefreshRate");
// Ref Rate komutunun gelip gelmediği kontrol ediliyor
if(itr != d.MemberEnd())
{
string refreshRateString;
int refreshRateInt;
// Document formatındaki JSON mesajı StrinBuffer'a dönüştürülüyor
Writer<StringBuffer> writer(buffer);
d["SetRefreshRate"].Accept(writer);
refreshRateString = buffer.GetString();
// Gelen mesajda fazladan çift tırnak ile bulunuyor
// Örneğin, ""15""
// Bu yüzden ilk son karakterler kırpılıyor
refreshRateString =
refreshRateString.substr(1, refreshRateString.size()-1);
// Refresh rate değeri stringden integera çevriliyor
refreshRateInt = atoi(refreshRateString.c_str());
refreshRate = refreshRateInt;
timelimit.setMaxDuration(std::chrono::milliseconds
(refreshRate*1000));
}
}
else
cout << "Invalid NodeID!" << endl;
}
}
status = serverReqReader->return_loan(serverReqSeq, infoSeq);
checkStatus(status, "ServerReqDataReader::return_loan");
refreshRateCounter++;
cout << refreshRateCounter << endl;
} // Matlab komutuna Subscribe olma kısmının sonu
// Terminalde akacak olan çıktıları dah gözle görülebilir bir şekilde
// yazdırmak için koyulmuştur
FakeDelay();
}
// Hafıza temizle işlemleri gerçekleştiriliyor
mgrBtPub.deleteWriter();
mgrBtPub.deletePublisher();
mgrBtPub.deleteTopic();
mgrBtPub.deleteParticipant();
mgrReqSub.deleteReader();
mgrReqSub.deleteSubscriber();
mgrReqSub.deleteTopic();
mgrReqSub.deleteParticipant();
return 0;
}
示例12: mergeFile
//.........这里部分代码省略.........
Value& n0 = doc0["description"]["-diagram"]["node"];
Value& n1 = doc1["description"]["-diagram"]["node"];
Value& n2 = doc2["description"]["-diagram"]["node"];
// 加入队列
nodeQueue0.push(&n0);
nodeQueue1.push(&n1);
nodeQueue2.push(&n2);
while(!nodeQueue0.empty())
{
cout<<"-------while-----------"<<endl;
// 从队列获取nodelist
Value* nodelist0 = nodeQueue0.front();
Value* nodelist1 = nodeQueue1.front();
Value* nodelist2 = nodeQueue2.front();
// ------------ nodelist1----------->>>
cout<<"-------1-----------"<<endl;
assert((*nodelist1).IsArray());
for(SizeType i = 0;i < (*nodelist1).Size(); i++)
{
cout<<"-------for-----------"<<endl;
// 声明用于保存冲突信息的对象
Value conflictNode_i(kObjectType);
conflictNode_i.AddMember("isDeleted", Value("false"), conflictDoc.GetAllocator());
Value conflict_key;
conflict_key.SetArray();
bool conflictHappened = false;
// 获取 node[i]的id
Value& id1_value = (*nodelist1)[i]["@shape_id"];
string id1_string = id1_value.GetString();
// 将id存入 conflictNode_i
Value temp;
temp.CopyFrom(id1_value, doc1.GetAllocator());
conflictNode_i.AddMember("shape_id", temp, conflictDoc.GetAllocator());
// 在nodelist2中找到相同id的节点
int j = findNodeByID((*nodelist2), id1_string); // 返回找到的节点下标
// 如果找到了相同节点,比较是否所有属性相同
if(j >= 0)
{
cout<<"-------j>=0-----------"<<endl;
// 从nodelist0中取出该节点(1、2有共同节点,一定是从0继承的,0一定存在该点)
int k = findNodeByID((*nodelist0), id1_string);
// merge anchors
mergeAnchors((*nodelist1)[i]["anchors"], (*nodelist2)[j]["anchors"], (*nodelist0)[k]["anchors"], doc2);
// --------将子节点数组加入队列---->>>
Value& subn0 = (*nodelist0)[k]["node"];
Value& subn1 = (*nodelist1)[i]["node"];
Value& subn2 = (*nodelist2)[j]["node"];
// 加入队列
nodeQueue0.push(&subn0);
nodeQueue1.push(&subn1);
nodeQueue2.push(&subn2);
// <<<-----将子节点数组加入队列-------
// ------对比text------>>>
cout<<"-------text-----------"<<endl;
示例13: CreateRouterMessage
int MessageBusFactory::CreateRouterMessage(MessageBus* messageBus, void** messageBuffer , bool useCompression)
{
StringBuffer sbMessageBus;
Writer<StringBuffer> writerBus(sbMessageBus);
messageBus->Serialize(writerBus);
void *serializedMessage = (void*) sbMessageBus.GetString();
int serializedMessageLen = sbMessageBus.GetSize();
Bytef *zBuffer = NULL;
if(useCompression)
{
z_stream defstream;
defstream.zalloc = Z_NULL;
defstream.zfree = Z_NULL;
defstream.opaque = Z_NULL;
defstream.avail_in = sbMessageBus.GetSize();
defstream.next_in = (Bytef *)sbMessageBus.GetString();
int zBufLen = (int) ceil(1.001 * sbMessageBus.GetSize()) + 12 + 6;
zBuffer = (Bytef *)malloc( zBufLen );
defstream.avail_out = zBufLen;
defstream.next_out = zBuffer;
deflateInit2( &defstream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY);
int status;
while( ( status = deflate( &defstream, Z_FINISH ) ) == Z_OK );
deflateEnd(&defstream);
serializedMessage = zBuffer;
serializedMessageLen = defstream.total_out;
}
int bufferLen = 15 + messageBus->Header.BodyType.size() + 4 + serializedMessageLen + 4;
CallerContext c1;
if(!messageBus->Header.CallStack.empty())
{
c1 = messageBus->Header.CallStack.top();
bufferLen += c1.Id.Id.size() + 4 + c1.Id.Type.size();
}
void* bufferRet = malloc(bufferLen);
char* pos = (char*)bufferRet;
memset(bufferRet, 0, bufferLen);
memcpy(pos, &(messageBus->Header.Type), sizeof(char));
pos += 1;
memcpy(pos, &(messageBus->Header.Priority), sizeof(char));
pos += 2; //Reservado
int64_t ticks = HermEsb::Utils::Time::TimeExtensions::ticks_from_mindate(messageBus->Header.CreatedAt);
memcpy(pos, &ticks, sizeof(int64_t));
pos +=sizeof(int64_t);
int bodytypeLen = messageBus->Header.BodyType.size();
memcpy(pos, &bodytypeLen, sizeof(int));
pos += sizeof(int);
memcpy(pos, messageBus->Header.BodyType.c_str(), bodytypeLen);
pos += bodytypeLen;
int bodysize = serializedMessageLen;
memcpy(pos, &bodysize, sizeof(int));
pos += sizeof(int);
memcpy(pos, serializedMessage, bodysize);
if(!c1.Id.Id.empty())
{
pos += bodysize;
int idLen = c1.Id.Id.size();
memcpy(pos, &idLen, sizeof(int));
pos += sizeof(int);
memcpy(pos, c1.Id.Id.c_str(), c1.Id.Id.size());
pos += c1.Id.Id.size();
int typeLen = c1.Id.Type.size();
memcpy(pos, &typeLen, sizeof(int));
pos += sizeof(int);
memcpy(pos, c1.Id.Type.c_str(), c1.Id.Type.size());
}
if(zBuffer!=NULL)
free(zBuffer);
*messageBuffer = bufferRet;
return bufferLen;
}
示例14: reciveMns
/**
* @brief SDSMemoryNode::reciveMns
* @param mns
*/
void SDSMemoryNode::reciveMns(char * message){
cout<<message<<endl;
Document doc;
doc.ParseInsitu(message);
if(doc.IsObject()){
if(doc.HasMember("protocolo")){
if(doc["protocolo"].IsString()){
string comando;
comando=doc["protocolo"].GetString();
if(comando=="d_calloc"){
if(doc.HasMember("pSize")){
if(doc["pSize"].IsInt()){
int pSize= doc["pSize"].GetInt();
d_calloc(pSize);
}
}
}
else if(comando=="d_status"){
d_status();
}
else{
d_pointer_size pointerSize;
if(doc.HasMember("dir")){
if(doc["dir"].IsInt()){
int pDir= doc["dir"].GetInt();
pointerSize.pointer.dirMemory=pDir;
}
}
if(doc.HasMember("pSize")){
if(doc["pSize"].IsInt()){
int pSize= doc["pSize"].GetInt();
pointerSize.bytes=pSize;
}
}
if(comando=="d_free"){
d_free(pointerSize);
}
else{
//Documento para en caso de que se quiera obtener el dato
StringBuffer s;
Writer<StringBuffer> writer(s);
writer.StartObject();
writer.String("dato");
int status;
bystream statusBystream;
if(doc.HasMember("tipo")){
if(doc["tipo"].IsString()){
string tipo= doc["tipo"].GetString();
if(tipo=="char"){
if(comando=="d_set"){
if(doc.HasMember("dato")){
if(doc["dato"].IsString()){
//Parsear a char
char pData =*(const_cast<char *>(doc["dato"].GetString()));
status= Manejador.setearDatoChar(pointerSize,pData);
}
}
}
if(comando=="d_get"){
statusBystream=Manejador.obtenerDatoChar(pointerSize);
writer.String(&(statusBystream.datachar));
}
}
else if(tipo=="int"){
if(comando=="d_set"){
if(doc.HasMember("dato")){
if(doc["dato"].IsInt()){
//Parsear a int
int pData =doc["dato"].GetInt();
status= Manejador.setearDatoInt(pointerSize,pData);
}
}
}
if(comando=="d_get"){
statusBystream=Manejador.obtenerDatoInt(pointerSize);
//.........这里部分代码省略.........
示例15: VerifyOverloadsForCLSCompliance
//.........这里部分代码省略.........
bool ParamTypesAreArrayOfArrays = false;
bool ParamsDifferOnlyByArrayRank = false;
{
BCSYM_Param *Param1;
BCSYM_Param *Param2;
for(Param1 = OverloadedProc->GetFirstParam(), Param2 = OverloadingProc->GetFirstParam();
Param1 && Param2;
Param1 = Param1->GetNext(), Param2 = Param2->GetNext())
{
// Don't do any checking if any of the parameters are bad
//
if (Param1->IsBad() || Param2->IsBad())
{
return;
}
// Note: Nothing special to do for optional and paramarrays
// because a CLS Compliant consumer can always call them by
// providing all the parameters.
//
BCSYM *Type1 = Param1->GetType();
BCSYM *Type2 = Param2->GetType();
if (Type1->IsArrayType() && Type2->IsArrayType())
{
BCSYM *ArrayElementType1 = Type1->PArrayType()->GetRoot();
BCSYM *ArrayElementType2 = Type2->PArrayType()->GetRoot();
if (ArrayElementType1->IsArrayType() &&
ArrayElementType2->IsArrayType())
{
ParamTypesAreArrayOfArrays = true;
continue;
}
else if (BCSYM::AreTypesEqual(ArrayElementType1, ArrayElementType2))
{
if (Type1->PArrayType()->GetRank() != Type2->PArrayType()->GetRank())
{
ParamsDifferOnlyByArrayRank = true;
}
continue;
}
// Signatures are different enough
}
else
{
if (BCSYM::AreTypesEqual(Type1, Type2))
{
continue;
}
}
// Signatures are different enough
//
return;
}
VSASSERT( !(Param1 && Param2),
"both non-NULLs Unexpected!!!");
// Different number of parameters, so Signatures are different enough
//
if (Param1 != Param2)
{
return;
}
}
VSASSERT( ParamTypesAreArrayOfArrays ||
ParamsDifferOnlyByArrayRank,
"How did two indetical overloads get through bindable ?");
if (ParamTypesAreArrayOfArrays ||
ParamsDifferOnlyByArrayRank)
{
//
// "'|1' which overloads '|2' differs from it only by array of array parameter types
// or by the rank of the the array parameter types and so is not CLS Compliant."
StringBuffer OverloadingMember;
StringBuffer OverloadedMember;
OverloadingProc->GetBasicRep(m_Compiler, OverloadingProc->GetContainer(), &OverloadingMember);
OverloadedProc->GetBasicRep(m_Compiler, OverloadedProc->GetContainer(), &OverloadedMember);
ReportErrorOnSymbol(
WRNID_ArrayOverloadsNonCLS2,
OverloadingProc,
OverloadingMember.GetString(),
OverloadedMember.GetString());
}
}