本文整理汇总了C++中Attachment类的典型用法代码示例。如果您正苦于以下问题:C++ Attachment类的具体用法?C++ Attachment怎么用?C++ Attachment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Attachment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printFieldContainer
void printFieldContainer() {
int N = FieldContainerFactory::the()->getNumTotalContainers();
for (int i=0;i<N;++i) {
FieldContainer* fc = FieldContainerFactory::the()->getContainer(i);
if(fc == 0) continue;
// skip prototypes
if(fc->getType().getPrototype() == 0 || fc->getType().getPrototype() == fc ) continue;
//cout << "\nFC id: " << fc->getId() << flush;
AttachmentContainer* ac = dynamic_cast<AttachmentContainer*>(fc);
if (ac == 0) {
Attachment* a = dynamic_cast<Attachment*>(fc);
if (a != 0) {
FieldContainer* dad = 0;
if (a->getMFParents()->size() > 0) dad = a->getParents(0);
ac = dynamic_cast<AttachmentContainer*>(dad);
}
}
const Char8* name = getName(ac);
if (name != 0) printf("Detected living FC %s (%s) %p refcount %d ID %d\n", fc->getTypeName(), name, fc, fc->getRefCount(), fc->getId());
else printf( "Detected living FC %s %p refcount %d ID %d\n", fc->getTypeName(), fc, fc->getRefCount(), fc->getId() );
}
}
示例2: Attachment
Attachment*
AttachArea::addAttachment(
DtMail::Message *msg,
DtMail::BodyPart *lastAttBP,
String name,
DtMailBuffer buf
)
{
DtMailEnv mail_error;
DtMail::BodyPart * bp = NULL;
if (!name)
name = "noname";
mail_error.clear();
bp = msg->newBodyPart(mail_error, lastAttBP);
bp->setContents(mail_error, buf.buffer, buf.size, NULL, name, 0, NULL);
Attachment *attachment = new Attachment(this,
name,
bp,
_iconCount + 1);
attachment->setAttachArea(this);
attachment->initialize();
addToList(attachment);
// Update the display. The Compose Window needs immediate update.
this->manageList();
return(attachment);
}
示例3: OSG_OSB_LOG
/*! Callback called for each element in an AttachmentMap (this is used by
preWriteAttachmentMapField).
*/
void OSBCommonElement::handleAttachmentMapElementPreWrite(
FieldContainer *refedFC)
{
OSG_OSB_LOG(("OSBCommonElement::handleAttachmentMapElementPreWrite\n"));
if(refedFC == NULL)
return;
Attachment *refedAtt = dynamic_cast<Attachment *>(refedFC);
// skip attachments marked as 'internal'
if(refedAtt == NULL ||
refedAtt->getSFInternal()->getValue() == true )
{
return;
}
OSBRootElement *root = editRoot();
UInt32 refedId = refedAtt->getId ();
const std::string &typeName = refedAtt->getType().getName();
// only schedule a container once
if(root->getIdSet().count(refedId) > 0)
return;
OSBElementBase *elem = OSBElementFactory::the()->acquire(typeName, root);
root->editIdSet ().insert (refedId);
root->editElementList().push_back(elem );
elem->setContainer(refedAtt);
elem->preWrite (refedAtt);
}
示例4: _
//
// Create a new attachment for this module
//
CSSM_HANDLE Module::attach(const CSSM_VERSION &version,
uint32 subserviceId,
CSSM_SERVICE_TYPE subserviceType,
const CSSM_API_MEMORY_FUNCS &memoryOps,
CSSM_ATTACH_FLAGS attachFlags,
CSSM_KEY_HIERARCHY keyHierarchy,
CSSM_FUNC_NAME_ADDR *functionTable,
uint32 functionTableSize)
{
StLock<Mutex> _(mLock);
// check if the module can do this kind of service
if (!supportsService(subserviceType))
CssmError::throwMe(CSSMERR_CSSM_INVALID_SERVICE_MASK);
Attachment *attachment = cssm.attachmentMakerFor(subserviceType)->make(this,
version,
subserviceId, subserviceType,
memoryOps,
attachFlags,
keyHierarchy,
functionTable, functionTableSize);
try {
// add to module's attachment map
attachmentMap.insert(AttachmentMap::value_type(attachment->handle(), attachment));
} catch (...) {
delete attachment;
throw;
}
// all done
return attachment->handle();
}
示例5: guard
void Attachment::IdleTimer::handler()
{
m_fireTime = 0;
if (!m_expTime) // Timer was reset to zero, do nothing
return;
// Ensure attachment is still alive and idle
StableAttachmentPart* stable = m_attachment->getStable();
if (!stable)
return;
MutexEnsureUnlock guard(*stable->getMutex(), FB_FUNCTION);
if (!guard.tryEnter())
return;
if (!m_expTime)
return;
// If timer was reset to fire later, restart ITimer
time_t curTime = time(NULL);
if (curTime < m_expTime)
{
reset(m_expTime - curTime);
return;
}
Attachment* att = stable->getHandle();
att->signalShutdown(isc_att_shut_idle);
JRD_shutdown_attachment(att);
}
示例6: Attachment
Attachment * Attachment::attachmentWithRFC822Message(Data * messageData)
{
Attachment * attachment;
attachment = new Attachment();
attachment->setMimeType(MCSTR("message/rfc822"));
attachment->setData(messageData);
return (Attachment *) attachment->autorelease();
}
示例7: if
void SSpineWidget::UpdateMesh(int32 LayerId, FSlateWindowElementList& OutDrawElements, const FGeometry& AllottedGeometry, Skeleton* Skeleton) {
TArray<FVector> vertices;
TArray<int32> indices;
TArray<FVector2D> uvs;
TArray<FColor> colors;
TArray<FVector> darkColors;
int idx = 0;
int meshSection = 0;
UMaterialInstanceDynamic* lastMaterial = nullptr;
SkeletonClipping &clipper = widget->clipper;
Vector<float> &worldVertices = widget->worldVertices;
float depthOffset = 0;
unsigned short quadIndices[] = { 0, 1, 2, 0, 2, 3 };
for (int i = 0; i < (int)Skeleton->getSlots().size(); ++i) {
Vector<float> &attachmentVertices = worldVertices;
unsigned short* attachmentIndices = nullptr;
int numVertices;
int numIndices;
AtlasRegion* attachmentAtlasRegion = nullptr;
Color attachmentColor;
attachmentColor.set(1, 1, 1, 1);
float* attachmentUvs = nullptr;
Slot* slot = Skeleton->getDrawOrder()[i];
Attachment* attachment = slot->getAttachment();
if (!attachment) continue;
if (!attachment->getRTTI().isExactly(RegionAttachment::rtti) && !attachment->getRTTI().isExactly(MeshAttachment::rtti) && !attachment->getRTTI().isExactly(ClippingAttachment::rtti)) continue;
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
RegionAttachment* regionAttachment = (RegionAttachment*)attachment;
attachmentColor.set(regionAttachment->getColor());
attachmentAtlasRegion = (AtlasRegion*)regionAttachment->getRendererObject();
regionAttachment->computeWorldVertices(slot->getBone(), attachmentVertices, 0, 2);
attachmentIndices = quadIndices;
attachmentUvs = regionAttachment->getUVs().buffer();
numVertices = 4;
numIndices = 6;
}
else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
MeshAttachment* mesh = (MeshAttachment*)attachment;
attachmentColor.set(mesh->getColor());
attachmentAtlasRegion = (AtlasRegion*)mesh->getRendererObject();
mesh->computeWorldVertices(*slot, 0, mesh->getWorldVerticesLength(), attachmentVertices, 0, 2);
attachmentIndices = mesh->getTriangles().buffer();
attachmentUvs = mesh->getUVs().buffer();
numVertices = mesh->getWorldVerticesLength() >> 1;
numIndices = mesh->getTriangles().size();
}
else /* clipping */ {
示例8:
void
ViewMsgDialog::invokeAttachmentAction(
int index
)
{
DtMailEditor *editor = this->get_editor();
AttachArea *attacharea = editor->attachArea();
Attachment *attachment = attacharea->getSelectedAttachment();
attachment->invokeAction(index);
}
示例9:
void
AttachArea::saveAttachmentToFile(
DtMailEnv &mail_error,
char *save_path
)
{
Attachment *attachment = this->getSelectedAttachment();
if(attachment != NULL)
attachment->saveToFile(mail_error, save_path);
}
示例10: getList
void
AttachArea::undeleteLastDeletedAttachment(
DtMailEnv &mail_error
)
{
Attachment *tmpAttachment;
Attachment **list;
time_t time_deleted = 0, tmpTime = 0;
int i;
if (_deleteCount == 0) {
return;
}
list = getList();
tmpAttachment = list[0];
time_deleted = tmpAttachment->getBodyPart()->getDeleteTime(mail_error);
if (mail_error.isSet()) {
// do something
}
for (i=1; i<getIconCount(); i++) {
if (list[i]->isDeleted()) {
tmpTime = list[i]->getBodyPart()->getDeleteTime(mail_error);
if (mail_error.isSet()) {
// do something
}
if ( tmpTime > time_deleted) {
time_deleted = tmpTime;
tmpAttachment = list[i];
}
}
}
tmpAttachment->undeleteIt();
_deleteCount--;
// Unmanage all.
// Their positions need to get recomputed and the deleted
// ones get remanaged in manageList().
for (i=0; i<getIconCount(); i++) {
list[i]->unmanageIconWidget();
}
this->manageList();
}
示例11: execSyncV
void AttachmentBase::execSyncV( FieldContainer &oFrom,
ConstFieldMaskArg whichField,
AspectOffsetStore &oOffsets,
ConstFieldMaskArg syncMode,
const UInt32 uiSyncInfo)
{
Attachment *pThis = static_cast<Attachment *>(this);
pThis->execSync(static_cast<Attachment *>(&oFrom),
whichField,
oOffsets,
syncMode,
uiSyncInfo);
}
示例12: kdDebug
void KOIncidenceEditor::createEmbeddedURLPages(Incidence *i)
{
kdDebug(5850) << "KOIncidenceEditor::createEmbeddedURLPages()" << endl;
if(!i) return;
if(!mEmbeddedURLPages.isEmpty())
{
kdDebug(5850) << "mEmbeddedURLPages are not empty, clearing it!" << endl;
mEmbeddedURLPages.setAutoDelete(true);
mEmbeddedURLPages.clear();
mEmbeddedURLPages.setAutoDelete(false);
}
if(!mAttachedDesignerFields.isEmpty())
{
for(QPtrList<QWidget>::Iterator it = mAttachedDesignerFields.begin();
it != mAttachedDesignerFields.end(); ++it)
{
if(mDesignerFieldForWidget.contains(*it))
{
mDesignerFields.remove(mDesignerFieldForWidget[ *it ]);
}
}
mAttachedDesignerFields.setAutoDelete(true);
mAttachedDesignerFields.clear();
mAttachedDesignerFields.setAutoDelete(false);
}
Attachment::List att = i->attachments();
for(Attachment::List::Iterator it = att.begin(); it != att.end(); ++it)
{
Attachment *a = (*it);
kdDebug(5850) << "Iterating over the attachments " << endl;
kdDebug(5850) << "label=" << a->label() << ", url=" << a->uri() << ", mimetype=" << a->mimeType() << endl;
if(a && a->showInline() && a->isUri())
{
// TODO: Allow more mime-types, but add security checks!
/* if ( a->mimeType() == "application/x-designer" ) {
QString tmpFile;
if ( KIO::NetAccess::download( a->uri(), tmpFile, this ) ) {
mAttachedDesignerFields.append( addDesignerTab( tmpFile ) );
KIO::NetAccess::removeTempFile( tmpFile );
}
} else*/
// TODO: Enable that check again!
if(a->mimeType() == "text/html")
{
setupEmbeddedURLPage(a->label(), a->uri(), a->mimeType());
}
}
}
}
示例13: RectangleObject
bool
WebGLFramebuffer::Attachment::HasSameDimensionsAs(const Attachment& other) const {
const WebGLRectangleObject *thisRect = RectangleObject();
const WebGLRectangleObject *otherRect = other.RectangleObject();
return thisRect &&
otherRect &&
thisRect->HasSameDimensionsAs(*otherRect);
}
示例14: SET_TDBB
void ExecuteStatement::execute(Jrd::thread_db* tdbb, jrd_req* request, DSC* desc)
{
SET_TDBB(tdbb);
Attachment* attachment = tdbb->getAttachment();
jrd_tra* const transaction = tdbb->getTransaction();
if (transaction->tra_callback_count >= MAX_CALLBACKS)
{
ERR_post(Arg::Gds(isc_exec_sql_max_call_exceeded));
}
Firebird::string sqlStatementText;
getString(tdbb, sqlStatementText, desc, request);
transaction->tra_callback_count++;
try
{
AutoPtr<PreparedStatement> stmt(attachment->prepareStatement(
tdbb, *tdbb->getDefaultPool(), transaction, sqlStatementText));
// Other requests appear to be incorrect in this context
const long requests =
(1 << REQ_INSERT) | (1 << REQ_DELETE) | (1 << REQ_UPDATE) |
(1 << REQ_DDL) | (1 << REQ_SET_GENERATOR) | (1 << REQ_EXEC_PROCEDURE) |
(1 << REQ_EXEC_BLOCK);
if (!((1 << stmt->getRequest()->req_type) & requests))
{
ERR_post(Arg::Gds(isc_sqlerr) << Arg::Num(-902) <<
Arg::Gds(isc_exec_sql_invalid_req) << Arg::Str(sqlStatementText));
}
stmt->execute(tdbb, transaction);
fb_assert(transaction == tdbb->getTransaction());
}
catch (const Firebird::Exception&)
{
transaction->tra_callback_count--;
throw;
}
transaction->tra_callback_count--;
}
示例15:
void FieldTraits<AttachmentMap>::copyFromBin(BinaryDataHandler &pMem,
AttachmentMap &aMap )
{
Attachment *attPtr;
UInt32 key;
UInt16 binding;
UInt32 fcId;
UInt32 size;
pMem.getValue(size);
AttachmentMap::const_iterator mapIt = aMap.begin();
AttachmentMap::const_iterator mapEnd = aMap.end ();
for(; mapIt != mapEnd; ++mapIt)
{
if((*mapIt).second != NULL)
{
Thread::getCurrentChangeList()->addDelayedSubRef<
UnrecordedRefCountPolicy>((*mapIt).second);
}
}
aMap.clear();
for(UInt32 i = 0; i < size; ++i)
{
pMem.getValue(binding);
pMem.getValue(fcId );
attPtr = dynamic_cast<Attachment *>(
FieldContainerFactory::the()->getMappedContainer(fcId));
if(attPtr != NULL)
{
key = (static_cast<UInt32>(attPtr->getGroupId()) << 16) | binding;
UnrecordedRefCountPolicy::addRef(attPtr);
aMap.insert(AttachmentMap::value_type(key, attPtr));
}
}
}