当前位置: 首页>>代码示例>>C++>>正文


C++ SetAttr函数代码示例

本文整理汇总了C++中SetAttr函数的典型用法代码示例。如果您正苦于以下问题:C++ SetAttr函数的具体用法?C++ SetAttr怎么用?C++ SetAttr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetAttr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NS_ENSURE_SUCCESS

nsresult
ImageDocument::CreateSyntheticDocument()
{
  // Synthesize an html document that refers to the image
  nsresult rv = MediaDocument::CreateSyntheticDocument();
  NS_ENSURE_SUCCESS(rv, rv);

  // Add the image element
  Element* body = GetBodyElement();
  if (!body) {
    NS_WARNING("no body on image document!");
    return NS_ERROR_FAILURE;
  }

  nsCOMPtr<nsINodeInfo> nodeInfo;
  nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::img, nullptr,
                                           kNameSpaceID_XHTML,
                                           nsIDOMNode::ELEMENT_NODE);

  mImageContent = NS_NewHTMLImageElement(nodeInfo.forget());
  if (!mImageContent) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mImageContent);
  NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED);

  nsAutoCString src;
  mDocumentURI->GetSpec(src);

  NS_ConvertUTF8toUTF16 srcString(src);
  // Make sure not to start the image load from here...
  imageLoader->SetLoadingEnabled(false);
  mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::src, srcString, false);
  mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, srcString, false);

  body->AppendChildTo(mImageContent, false);
  imageLoader->SetLoadingEnabled(true);

  return NS_OK;
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:40,代码来源:ImageDocument.cpp

示例2: UpdateTitleAndCharset

nsresult
ImageDocument::OnStopRequest(imgIRequest *aRequest,
                             nsresult aStatus)
{
  UpdateTitleAndCharset();

  // mImageContent can be null if the document is already destroyed
  if (NS_FAILED(aStatus) && mStringBundle && mImageContent) {
    nsAutoCString src;
    mDocumentURI->GetSpec(src);
    NS_ConvertUTF8toUTF16 srcString(src);
    const char16_t* formatString[] = { srcString.get() };
    nsXPIDLString errorMsg;
    NS_NAMED_LITERAL_STRING(str, "InvalidImage");
    mStringBundle->FormatStringFromName(str.get(), formatString, 1,
                                        getter_Copies(errorMsg));

    mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, errorMsg, false);
  }

  return NS_OK;
}
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:22,代码来源:ImageDocument.cpp

示例3: SetAttr

CCharBase * CItem::Spawn_SetTrackID()
{
	if ( ! IsType(IT_SPAWN_CHAR))
		return NULL;
	CCharBase * pCharDef = NULL;
	RESOURCE_ID_BASE rid = m_itSpawnChar.m_CharID;

	if ( rid.GetResType() == RES_CHARDEF )
	{
		CREID_TYPE id = (CREID_TYPE) rid.GetResIndex();
		pCharDef = CCharBase::FindCharBase( id );
	}
	if ( pCharDef )
		SetAttr( ATTR_INVIS );
	if ( IsAttr(ATTR_INVIS))	// They must want it to look like this.
	{
		SetDispID( ( pCharDef == NULL ) ? ITEMID_TRACK_WISP : pCharDef->m_trackID );
		if ( GetHue() == 0 )
			SetHue( HUE_RED_DARK );	// Indicate to GM's that it is invis.
	}
	return( pCharDef );
}
开发者ID:GenerationOfWorlds,项目名称:Sphere,代码行数:22,代码来源:CItemSp.cpp

示例4: render_char

static NCURSES_INLINE cchar_t
render_char(WINDOW *win, cchar_t ch)
/* compute a rendition of the given char correct for the current context */
{
    attr_t a = WINDOW_ATTRS(win);
    int pair = GetPair(ch);

    if (ISBLANK(ch)
	&& AttrOf(ch) == A_NORMAL
	&& pair == 0) {
	/* color/pair in attrs has precedence over bkgrnd */
	ch = win->_nc_bkgd;
	SetAttr(ch, a | AttrOf(win->_nc_bkgd));
	if ((pair = GET_WINDOW_PAIR(win)) == 0)
	    pair = GetPair(win->_nc_bkgd);
	SetPair(ch, pair);
    } else {
	/* color in attrs has precedence over bkgrnd */
	a |= AttrOf(win->_nc_bkgd) & COLOR_MASK(a);
	/* color in ch has precedence */
	if (pair == 0) {
	    if ((pair = GET_WINDOW_PAIR(win)) == 0)
		pair = GetPair(win->_nc_bkgd);
	}
	AddAttr(ch, (a & COLOR_MASK(AttrOf(ch))));
	SetPair(ch, pair);
    }

    TR(TRACE_VIRTPUT,
       ("render_char bkg %s (%d), attrs %s (%d) -> ch %s (%d)",
	_tracech_t2(1, CHREF(win->_nc_bkgd)),
	GetPair(win->_nc_bkgd),
	_traceattr(WINDOW_ATTRS(win)),
	GET_WINDOW_PAIR(win),
	_tracech_t2(3, CHREF(ch)),
	GetPair(ch)));

    return (ch);
}
开发者ID:ThomasDickey,项目名称:ncurses-snapshots,代码行数:39,代码来源:lib_add_wch.c

示例5: chunk

void CacheBase::Write(std::string path, const char* buf, size_t size, off_t off)
{
	FileContent& file = content_list.GetFile(path);
	FileChunk chunk(buf, off, size);
	file.SetChunk(chunk);

	/* No need to lock cache, we don't touch its members */
	pf_stat stat = GetAttr(path);
	time_t now = time(NULL);
	stat.meta_mtime = now;
	stat.mtime = now;
	stat.ctime = now;
	IDList idlist;
	idlist.insert(environment.my_id.Get());
	if(off + (off_t)size > (off_t)stat.size)
	{
		stat.size = (size_t)off + size;
		SetAttr(path, stat, idlist);
	}

	//content_list.RefreshPeersRef(path);
}
开发者ID:TheArboreProject,项目名称:Arbore-DHT,代码行数:22,代码来源:cache_base.cpp

示例6: ADDTOCALLSTACK

// Animals will eat crops before they are ripe, so we need a way to reset them prematurely
void CItem::Plant_CropReset()
{
	ADDTOCALLSTACK("CItem::Plant_CropReset");

	if ( ! IsType(IT_CROPS) && ! IsType(IT_FOLIAGE))
	{
		// This isn't a crop, and since it just got eaten, we should delete it
		Delete();
		return;
	}

	const CItemBase * pItemDef = Item_GetDef();
	ITEMID_TYPE iResetID = static_cast<ITEMID_TYPE>(RES_GET_INDEX(pItemDef->m_ttCrops.m_idReset));
	if ( iResetID != ITEMID_NOTHING )
	{
		SetID(iResetID);
	}

	Plant_SetTimer();
	RemoveFromView();	// remove from most screens.
	SetHue( HUE_RED_DARK );	// Indicate to GM's that it is growing.
	SetAttr(ATTR_INVIS);	// regrown invis.
}
开发者ID:leandrorenato,项目名称:Source,代码行数:24,代码来源:CItemSpawn.cpp

示例7: VSetAttr

void VSetAttr (VAttrList list, VStringConst name,
	       VDictEntry *dict, VRepnKind repn, ...)
{
    va_list args;
    VAttrListPosn posn;
    VAttrRec *a;

    /* Locate any existing attribute of the specified name: */
    va_start (args, repn);
    if (VLookupAttr (list, name, & posn))
	SetAttr (& posn, dict, repn, & args);
    else {

	/* None exists -- append a new attribute of that name: */
	a = NewAttr (name, dict, repn, & args);
	a->next = NULL;
	if (a->prev = list->prev)
	    a->prev->next = a;
	else list->next = a;
	list->prev = a;
    }
    va_end (args);
}
开发者ID:Rollmops,项目名称:via,代码行数:23,代码来源:Attr.c

示例8: Delete

void CItem::Plant_CropReset()
{
	// Animals will eat crops before they are ripe, so we need a way to reset them prematurely

	if ( ! IsType(IT_CROPS) && ! IsType(IT_FOLIAGE))
	{
		// This isn't a crop, and since it just got eaten, we should delete it
		Delete();
		return;
	}

	CItemBase * pItemDef = Item_GetDef();
	ITEMID_TYPE iResetID = (ITEMID_TYPE) RES_GET_INDEX( pItemDef->m_ttCrops.m_idReset );
	if ( iResetID != ITEMID_NOTHING )
	{
		SetID(iResetID);
	}

	Plant_SetTimer();
	RemoveFromView();	// remove from most screens.
	SetHue( HUE_RED_DARK );	// Indicate to GM's that it is growing.
	SetAttr(ATTR_INVIS);	// regrown invis.
}
开发者ID:GenerationOfWorlds,项目名称:Sphere,代码行数:23,代码来源:CItemSp.cpp

示例9: setcchar

setcchar(cchar_t * wcval, const wchar_t * wch, const attr_t attrs,
	 short color_pair, const void *opts)
{
    int i;
    int len;
    int code = OK;

    TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%ld,%d,%p)"),
		      wcval, _nc_viswbuf(wch), attrs, color_pair, opts));

    if (opts != NULL || (len = wcslen(wch)) > CCHARW_MAX
	|| (len > 0 && wcwidth(wch[0]) < 0)) {
	code = ERR;
    } else {

	for (i = 1; i < len; ++i) {
	    if (wcwidth(wch[i]) != 0) {
		code = ERR;
		break;
	    }
	}

	if (code != ERR) {
	    memset(wcval, 0, sizeof(*wcval));

	    if (len != 0) {
		SetAttr(*wcval, attrs | color_pair);
		memcpy(&wcval->chars, wch, len * sizeof(wchar_t));
		TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len,
				  _tracecchar_t(wcval)));
	    }
	}
    }

    TR(TRACE_CCALLS, (T_RETURN("%d"), code));
    return (code);
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:37,代码来源:lib_cchar.c

示例10: NCURSES_SP_NAME

NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx
			       const attr_t attr,
			       short color_pair_number,
			       void *opts)
{
    int code = ERR;

    T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number));

    if (SP_PARM != 0
	&& SP_PARM->_slk != 0
	&& !opts
	&& color_pair_number >= 0
	&& color_pair_number < SP_PARM->_pair_limit) {
	TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
	SetAttr(SP_PARM->_slk->attr, attr);
	if (color_pair_number > 0) {
	    SetPair(SP_PARM->_slk->attr, color_pair_number);
	}
	TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
	code = OK;
    }
    returnCode(code);
}
开发者ID:OpenInkpot-archive,项目名称:iplinux-ncurses,代码行数:24,代码来源:lib_slkatr_set.c

示例11: ActMsgContextMenu

/*-------------------------------------------------------------------------
                            ActMsgContextMenu
--------------------------------------------------------------------------*/
MRESULT ActMsgContextMenu( WNDATTR *wndattr, USHORT x, USHORT y )
{
 BOOL state;

   if (Popup == NULLHANDLE)
      return MRFROMSHORT( TRUE );

   if (MateScrollWnd != NULLHANDLE) {
      if (WinIsWindow( wndattr->hab, MateScrollWnd ) == FALSE)
         MateScrollWnd = NULLHANDLE;
   }

   state = (LPListMarkedLines( wndattr->list ) == 0);
   SetAttr( CMD_COPY, MIA_DISABLED, state );
   SetAttr( CMD_UNMARK, MIA_DISABLED, state );
   SetAttr( CMD_REARRANGE, MIA_DISABLED, state );

   WinOpenClipbrd( wndattr->hab );
   state = (WinQueryClipbrdData( wndattr->hab, CF_TEXT ) == 0);
   WinCloseClipbrd( wndattr->hab );
   SetAttr( CMD_PASTE, MIA_DISABLED, state );

   state = (WinQueryClipbrdViewer( wndattr->hab ) == wndattr->Client);
   SetAttr( CMD_ACCUM, MIA_CHECKED, state );

   state = (MateScrollWnd != NULLHANDLE);
   SetAttr( CMD_MATE, MIA_CHECKED, state );

   WinPopupMenu( wndattr->Frame,
                 wndattr->Frame,
                 Popup,
                 x, y, CMD_ABOUT,
                 PU_HCONSTRAIN | PU_VCONSTRAIN | PU_POSITIONONITEM |
                 PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 );

   return MRFROMSHORT( FALSE );
}
开发者ID:OS2World,项目名称:UTIL-FILEMANAGER-FastList,代码行数:40,代码来源:menu.c

示例12: SetAttr

NS_IMETHODIMP
HTMLAreaElement::SetTarget(const nsAString& aValue)
{
  return SetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue, true);
}
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:5,代码来源:HTMLAreaElement.cpp

示例13: SetAttr

void sDiskItem::SetString(sInt attr,sChar *buffer)
{
  if(sDiskItemTypes[attr][0]==sDIT_STRING && Support(attr))
    SetAttr(attr,buffer,sGetStringLen(buffer)+1);
}
开发者ID:Ambrevar,项目名称:fr_public,代码行数:5,代码来源:_diskitem.cpp

示例14: SetAttr

NS_IMETHODIMP nsSVGElement::SetId(const nsAString & aId)
{
  return SetAttr(kNameSpaceID_None, nsGkAtoms::id, aId, PR_TRUE);
}
开发者ID:AllenDou,项目名称:firefox,代码行数:4,代码来源:nsSVGElement.cpp

示例15: SetAttr

void
SVGAElement::SetHreflang(const nsAString& aHreflang, mozilla::ErrorResult& rv)
{
  SetAttr(nsGkAtoms::hreflang, aHreflang, rv);
}
开发者ID:heiher,项目名称:gecko-dev,代码行数:5,代码来源:SVGAElement.cpp


注:本文中的SetAttr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。