/** \brief convert the object to a string more 'human readable'
 * 
 * - NOTE: it may contains \n or other 'beautifuller'
 */
std::string	upnp_portdesc_t::to_human_str()	const throw()
{
	std::ostringstream	oss;
	// handle the null case
	if( is_null() )	return "null";
	// build the string to return
	oss << sockfam() << " " << ipport_pview() << " -> " << ipport_lview();
	
	oss << "\t";
	oss << "desc='" << desc_str() << "'";
	oss << "\n";
	oss << "\tlease_delay=" << lease_delay();
	oss << "\tmap_enabled=" << (map_enabled() ? "yes" : "no");
	
	// display the portcleaner part
	oss << "\tPortcleaner_tag(";
	if( has_portcleaner_tag() ){
		oss << "lease of " << portcleaner_lease() << " with nonce " << portcleaner_nonce();
	}else{
		oss << "not present";
	}
	oss << ")";
	// return the just built string
	return oss.str();
}
Example #2
0
void line(int type, Point p1, Point p2, Attr *desc)	/* draw a line segment */
{
	fprintf(tfd, "%s %s from %s",
		type==LINE ? "line" : "arrow",  desc_str(desc), xyname(p1));
	fprintf(tfd, " to %s", xyname(p2));	/* 'cause xyname is botched */
	fprintf(tfd, "\n");
	range(p1);
	range(p2);
}
Example #3
0
void next(Obj *p, Point pt, Attr *desc)	/* add component to a path */
{
	char *s;

	if (p->first == 0) {
		p->first++;
		fprintf(tfd, "L%s: %s\n", p->name, xyname(pt));
	} else {
		fprintf(tfd, "line %s from L%s to %s; L%s: Here\n",
			desc_str(desc->type ? desc : p->attr),
			p->name, xyname(pt), p->name);
	}
	if (p->attr && (s=p->attr->sval)) {
		/* BUG: should fix size here */
		fprintf(tfd, "\"%s\" at %s\n", s, xyname(pt));
	}
	range(pt);
}
Example #4
0
void frameside(int type, Attr *desc)	/* create and remember sides */
{
	int n;
	char buf[100];

	nsides++;
	switch (type) {
	case 0:		/* no side specified; kludge up all */
		frameside(TOP, desc);
		frameside(BOT, desc);
		frameside(LEFT, desc);
		frameside(RIGHT, desc);
		return;
	case TOP:	n = 0; break;
	case BOT:	n = 1; break;
	case LEFT:	n = 2; break;
	case RIGHT:	n = 3; break;
	}
	sprintf(buf, "%s %s", sides[n], desc_str(desc));
	newsides[n] = tostring(buf);
}