bool checkRelatedFunctions() {
		const Definition* cs = this->classOrStruct();
        if (!cs) {
            return true;
        }
        const Definition* topic = cs->fParent;
        SkASSERT(topic);
        SkASSERT(MarkType::kTopic == topic->fMarkType);
        string topicName = topic->fName;
        vector<string> methodNames;
        vector<string> reported;
		string prefix = cs->fName + "::";
		for (auto& csChild : cs->fChildren) {
            checkMethod(topicName, csChild, &reported);
		}
        for (auto missing : reported) {
            string fullname = topicName + '_' + missing;
            PRINTF("No #Subtopic: %s\n", fullname.c_str());
        }
		return true;
	}
 void checkMethod(string topic, const Definition* csChild, vector<string>* reported) {
     if (MarkType::kSubtopic == csChild->fMarkType) {
         for (auto child : csChild->fChildren) {
             checkMethod(topic, child, reported);
         }
         return;
     } else if (MarkType::kMethod != csChild->fMarkType) {
         // only check methods for now
         return;
     }
     bool containsMarkTypeIn = csChild->fDeprecated  // no markup for deprecated
             || Definition::MethodType::kConstructor == csChild->fMethodType
             || Definition::MethodType::kDestructor == csChild->fMethodType
             || Definition::MethodType::kOperator == csChild->fMethodType
             || csChild->fClone;
     for (auto child : csChild->fChildren) {
         if (MarkType::kIn == child->fMarkType) {
             containsMarkTypeIn = true;
             string subtopic(child->fContentStart,
                 child->fContentEnd - child->fContentStart);
             string fullname = topic + '_' + subtopic;
             auto topEnd = fBmhParser.fTopicMap.end();
             auto topFind = fBmhParser.fTopicMap.find(fullname);
             auto reportEnd = reported->end();
             auto reportFind = std::find(reported->begin(), reported->end(), subtopic);
             if (topEnd == topFind) {
                 if (reportEnd == reportFind) {
                     reported->push_back(subtopic);
                 }
             }
         }
     }
     if (!containsMarkTypeIn) {
         PRINTF("No #In: %s\n", csChild->fName.c_str());
     }
 }
示例#3
0
/**
* parseRequest : parses the given http request and generates the
* appropriate response
* args: 
	buffer: incoming http request
	responseBuffer: buffer to fill the response
* return:
	none
*/
void parseRequest(char *buffer, bufStruct *response,char *rootDirPath) {

	int size = 0;
	int uriLength = 0;
	int httpLength = 0;
	char methodName[MAX_BUF_SIZE + 1];
	char uri[MAX_BUF_SIZE + 1];
	char httpVersion[MAX_BUF_SIZE + 1];
	char ch;
	FILE *fp = NULL;
	int method = -1;
	char resourcePath[MAX_PATH] = "";
	char finalURI[MAX_PATH]="";

	while((size < MAX_BUF_SIZE ) && ( (ch = buffer[size]) != ' ')) 
	{
		methodName[size] = ch;
		size++;
	}
	
	
	methodName[size] = '\0';
	
	//check Get method 
	response->entitySize = 0;
	
	if((method = checkMethod(methodName)) == FAILURE) 
	{
		serveError(501,response,FAILURE);
		return;
	}	


	/*increment size to skip space delimiter*/
	size++;
	
	/*check uri*/
	while((size < MAX_BUF_SIZE) && ((ch = buffer[size]) != ' ')) 
	{
		uri[uriLength] = ch;
		uriLength++;
		size++;

	}
	
	uri[uriLength] = '\0';
	

	getFinalURI(uri,finalURI);
	strcpy(resourcePath,rootDirPath);
	strcat(resourcePath,finalURI);

	//Check resource path:
	int fileError = checkFile(resourcePath);
	if(fileError != SUCCESS)
	{
		serveError(fileError,response,method);
		return;
	}

	//finding resource
	if((fp = openFile(resourcePath)) == NULL )
	{
		serveError(404,response,method);
		return;
	}


	/*increment size to skip space delimiter*/
    size++;

	while((size < MAX_BUF_SIZE ) && ( (ch = buffer[size]) != '\r')) 
	{
        httpVersion[httpLength] = ch;
		httpLength++;
        size++;
	}

	httpVersion[httpLength] = '\0';

	if(checkHttpVersion(httpVersion) == -1)
	{		
		serveError(505,response,method);
		return;
	}

	/*increment the size and check for '\n' */
	int returnVal = checkHeader(buffer,size);
	if(returnVal == FAILURE)
	{
		serveError(400,response,method);
		return;
	}


	/*Parse header if needed*/
	/*file return*/

	if(method == GET) 
	{
		serveGet(response,fp,resourcePath);
		return;
	}
	else if( method == HEAD) 
	{
		serveHead(response,fp,resourcePath);
		return;
	} 

	else 
	{
		/*Control  never reaches here*/
		exit(FAILURE);
	}

}